Usart Module Error when Using PIC18F1330

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Francesco.C
Posts: 41
Joined: Thu Feb 26, 2009 6:54 pm
Location: UK

Usart Module Error when Using PIC18F1330

Post by Francesco.C » Wed Jul 27, 2011 8:23 pm

Hi there,
I have just started to write a comms application using PIC18F1330.

The compiler stop with an error in the USART module at line 69 thus:

"RCInput As TRISC.Booleans(7),"

It looks as if it doed not support the above device!!
Or maybe I am missing something obvious.

Can you help please?

Regards

Francesco

This is my code:

......................................................................
Device = 18F1330
Clock = 4
Include "usart.bas"

#option TXSTA=%10101110
#option RSTA=%10011010

USART.SetBaudrate(br9600)

..................................................................

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Thu Jul 28, 2011 7:40 am

TRISC ???? :shock: the PIC18F1330 does not have a PortC !!!
If I remember (check the datasheet), the PIC18F1330 had the UART at (RA2==TX) and (RA3==RX)
Last edited by octal on Thu Jul 28, 2011 10:26 am, edited 1 time in total.

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Thu Jul 28, 2011 7:56 am

Just checked the USART module, seem it does not take into account the 18F1230 and 18F1330 :(

correction to do:

at Line 65 in the USART module:

Code: Select all

   #if _device in (18F1220, 18F1320)
   RCInput As TRISB.Booleans(4),
   TXInput As TRISB.Booleans(1)
   #else
   RCInput As TRISC.Booleans(7),
   TXInput As TRISC.Booleans(6)
   #endif
replace by this :

Code: Select all

   #if _device in (18F1220, 18F1320)
   RCInput As TRISB.Booleans(4),
   TXInput As TRISB.Booleans(1)
   #elseif _device in (18F1230, 18F1330)
   RCInput As TRISA.Booleans(3),
   TXInput As TRISA.Booleans(2)
   #else
   RCInput As TRISC.Booleans(7),
   TXInput As TRISC.Booleans(6)
   #endif
this should work!!! (no need to modify initialization code as PinA.3 and pinA2 does not have analog module on them.

Francesco.C
Posts: 41
Joined: Thu Feb 26, 2009 6:54 pm
Location: UK

Post by Francesco.C » Thu Jul 28, 2011 8:30 pm

Thank you octal, it works.

Regards

Francesco

Post Reply