Oh I clapped my hands when I found this, thought i had got a working example of hserout...
didnt work for me.........
I changed it a little as I like to run at OSC 48 etc, and dont use a boot loader, and didnt need hserin, so just did a hserout and a 1 second pause to see if i could receive at the PC end, but I get the wrong chars, usually =_Y=_Y etc repeated
Code:' Baudrate : 9600 Bauds ' Method : Polling USART interrupts flags ' Pic Definition ' ============== ' Using PIC 18F2550 @ 48 MHZ ' DEFINE OSC 48 clear ADCON1 = %00001111 ' Hardware configuration ' ====================== TRISC = %10000000 ' PORTC.7 is the RX input ' PORTC.6 is the TX output ' Serial communication definition ' =============================== ' Using internal USART and MAX232 to interface to PC ' DEFINE HSER_RCSTA 90h ' enable serial port, ' enable continuous receive ' DEFINE HSER_TXSTA 20h ' enable transmit, ' BRGH=1 ' DEFINE HSER_BAUD 9600 DEFINE HSER_CLROERR 1 ' automatic clear overrun error ' Alias definition ' ================ RCIF VAR PIR1.5 ' Receive interrupt flag (1=full , 0=empty) TXIF VAR PIR1.4 ' Transmit interrupt flag (1=empty, 0=full) ' Variable definition ' =================== SerialData var byte ' Hardware initialisation ' ======================= pause 10 ' safe start-up delay Main: pause 1000 toggle portb.0 hserout [65,10,13] ' send it goto main
Also portC.1 goes high ?
led flashes 1 second on and 1 second off so i'd say cpudiv etc is right.
Have i done anything obviously wrong?




Bookmarks