The commands I provided were the UART setup.
The commands used to send data are simply HSEROUT and HSERIN. In the interest of saving space and not distracting from the problem by including loads of code no one will need to see, here is a snippet of relevant code from my software, which I have run successfully at 40MHz on an 18F4220.
'clock & PLL config
OSCCON = $72
OSCTUNE.6 = 1
ADCON1 = $0F
CMCON = $07
DEFINE OSC 32
'harware UART settings
DEFINE HSER_RCSTA 90H
DEFINE HSER_TXSTA 20H
DEFINE HSER_CLROERR 1
DEFINE HSER_BAUD 38400
'various port settings
TRISA = $FF
TRISB = $00
TRISC.4 = 0
TRISC.5 = 0
TRISD = $FF
'' symbols have been left out to save space in post
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''
'' main
InitWave= 0
InitDA = 0
PORTB = 0
LOW CLKEN
PAUSE 100 'allow guys to settle
HSEROUT [10,13,"..."]
PAUSE 500
'start A/D converters
HIGH CLKEN
'' main menu prompt ''''''''''''''''''''''''''''''''''''''''''
HSEROUT [10,13,10,13,"Startup successful."]
DispMenu: 'menu display, falls through
HSEROUT [10,13,"blah blah blah"]
HSEROUT [10,13,"blah blah blah"]
---------
On this PIC, RC6 and RC7 are TX and RX respectfully. I am using a max232 and it is connected as illustrated in any common 232/uart app note. There are loads of examples if you search mikroelectronika or similar DIY sites.
Bookmarks