tom 2007 0 Posted October 20, 2007 Report Share Posted October 20, 2007 hello I want to receive data from my pc to the PIC. I have configured everything (not sure if it is correct) but there is no interrupt generated. code: #pragma DATA 0x2007,0x3D0A 'HS OSC #pragma CLOCK_FREQ 16000000 sub interrupt () dim Data as byte porta.3 = !porta.3 'to test if interrupt gen. but doesn't do anything if pir1.5 = 1 then Data = rcreg 'process Data ... pir1.5 = 0 end if end sub sub main() trisa.1 = 0 trisa.2 = 0 trisa.0 = 0 intcon = intcon | (1 << PEIE) 'enable peh. interrupts intcon = intcon | (1 << GIE) 'enable global interrupt pie1 = pie1 | ( 1 << RCIE) trisb.1 = 1 'enable for input trisb.2 = 1 ' " " " spbrg = 207 '@ 16Mhz: 1200 baud txsta = txsta & ~ (1 << BRGH) txsta = txsta & ~ (1 << SYNC) rcsta = rcsta | ( 1 << RX9) rcsta = rcsta & ~ (1 << ADEN) txsta = txsta | (1 << CREN) rcsta = rcsta | ( 1 << SPEN) cmcon = 7 'program starts here.... end sub Anyone knows if this code is correct? Also the signal at RX pin is this inverted from the PC signal or is it the same? Configuration at pc: 1200 baud, no parity, 8 bits, 1 stop bit Thnx Tom Quote Link to post Share on other sites
c58_4311 0 Posted October 22, 2007 Report Share Posted October 22, 2007 dear TOM, Please see if you can recieve and send the characters via USART without using interrupt. You can follow he example code written in boostbasic. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.