Thanks for the assistance
I've just sat down with a large mug of coffee and some toast and run through the datasheet... I think I've covered most things (I still find these datasheets a struggle, but hopefully picking things up). I've set the registers as follows (with comments), and the code compiles
Having compiled and loaded the code, pleased to say it all works now !!Code:ASM __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF endasm DEFINE OSC 4 DEFINE HSER_RCSTA 90h 'Enable serial port & continuous receive DEFINE HSER_TXSTA 24h 'Enable transmit, BRGH = 1 DEFINE HSER_SPBRG 25 '9600 Baud @ 0.16% DEFINE HSER_CLROERR 1 'Clear overflow automatically ANSEL = %00000000 'Set all pins digital ANSELH = %00000000 'Set all pins digital ADCON0 = %00000000 'AD converter module disabled OSCCON = %01100101 'bit7 not used, bits 6-4 4mhz default, bit3 int osc, bit2 HS stable (ignored - at 4Mhz), bit1 not stable, bit0 int osc used for system clk CCP1CON= %00000000 'Turn off CCP module SSPCON = %00001011 'Ic2 master TRISA=%00000011 'set PORTA as all output apart from RA0 and RA1( bits 7&8 unimplimented read as 0) TRISB=%11110000 'set PORTB as all input ( bits 0-3 unimplimented read as 0) TRISC=%11111111 'set PORTC as all input (default for POR)
OK I might of gone overboard on configuring registers, but at least it's helped me get some understanding with the datasheets.




Bookmarks