2011-03-01, 08:43:17
(2011-02-28, 22:10:23)Mikael Gustafsson Wrote: How do you set up the uart on your working application?
I am using a MAX 232 Chip on my RS232 PCB and I have connected the TX pin to TX Pin 25 on the Pic (RC6) and the RX pin to Pin 26 (RC7).
Device = 18F4620
Xtal = 20
Bootloader=On
All_Digital=TRUE
Optimiser_Level=3 '
Dead_Code_Remove=On '
Keypad_Port=PORTB
PortB_Pullups = On
Stack_Size=40 '
Declare Hbus_Bitrate 400
Declare Float_Display_Type = fast '
Warnings=off
Reminders=off
Declare serial_data 8 ' Set Serin & Serout data Bits to 8
RCSTA.7 = 1
-------------------------------------------------------------------------------
Hserial_Baud = 19200 ' SET BAUD RATE TO 9600
Hserial_RCSTA = %10010000 ' ENABLE SERIAL PORT AND CONTINUOUS RECEIVE
Hserial_TXSTA = %00100100 ' ENABLE TRANSMIT AND ASYNCHRONOUS MODE
Hserial_Clear = On ' ENABLE ERROR CLEARING ON RECEIVED CHARACTERS
'-------------------------------------------------------------------------------
ADCON0 = %00001111 ' RA3 Pins set for 12vdc Battery Monitoring *****16F887**** ADCON0 = %01001101
ADCON1 = %00001101 ' ADC Setup for Battery Level Monitoring *****16F887**** ADCON1 = %11001111
ADCON2 = %10101101
Adin_Stime = 50 ' Allow 50us sample time for the ADC
'--------------------------------------------------------------------------------
TRISA=%00011100 ' Pin RA4 is the Input for the Door Switch
TRISB=%00000000
TRISC=%11000001 ' Pin C
TRISD=%00000000
TRISE=%00000000
PORTA=0
PORTB=0
PORTC=0
PORTD=0
PORTE=0
Thanks
Craig