It is my understanding of the GPS sentences that the GPS sends the data stream when it wants to - not on request. If that is the case the incoming data will be asynchronous to your PIC and, while you can use a timer interrupt, it will be awkward. What you would have to do is interrupt at some multiple of the baud rate (16x?), detect pulse edges for each bit, assemble the bits into bytes, assemble the bytes into sentences and leave the sentence in a buffer for the main program. I assume you will use the USART for your wireless device where it too will be asynchronous but you have that covered in the device interrupt code. Look around at Microchip for bit-banged serial code and, if necessary, convert it to interrupt driven on a timer. Or find a device with 2 USARTS like 18X6x2x. I did a search at www.microchip.com for 'dual usart' and came up with a lot of hits so the devices are available. --- In , honamos@y... wrote: > Any ideas on getting that second stream (GPS) to read only once a > second without delaying the rest of the program? > > --- In , Duane Mohney <dpmohne@g...> wrote: > > According to the datasheet from Microchip this device has only one > > USART. This is how CCS PCWH 3.202 is setup according to the > ChipEdit > > utility. > > > > The second RS232 stream that you are attempting to is not > generating > > an interrupt. > > > > Duane > > > > > > > > > > On Tue, 13 Jul 2004 05:09:33 -0000, honamos@y... <honamos@y...> > wrote: > > > PIC 18F458. I THINK it does have to serial ports. I'm not > sure.. > > > > > > --- In , Duane Mohney <dpmohne@g...> > wrote: > > > > What chip are you using? does it has 2 usarts? > > > > > > > > what are your #use rs232 settings? > > > > > > > > I would imagine the chip doesnt have 2 usarts, and the GPS > stream > > > is > > > > running on a software serial and therefore not generating > > > interrupts. > > > > > > > > -Duane > > > > > > > > > > > > > > > > > > > > On Tue, 13 Jul 2004 00:02:43 -0000, honamos@y... <honamos@y...> > > > wrote: > > > > > I have the CCS C Compiler... here is my code > > > > > --------- > > > > > void serial_isr() { > > > > > int t; > > > > > > > > > > buffer[next_in]=fgetc(TRANS); > > > > > t=next_in; > > > > > next_in=(next_in+1) % BUFFER_SIZE; > > > > > if(next_in==next_out) > > > > > next_in=t; // Buffer full !! > > > > > } > > > > > > > > > > #define bkbhit (next_in!=next_out) > > > > > > > > > > BYTE bgetc() { > > > > > BYTE c; > > > > > > > > > > while(!bkbhit) ; > > > > > c=buffer[next_out]; > > > > > next_out=(next_out+1) % BUFFER_SIZE; > > > > > return(c); > > > > > } > > > > > > > > > > void main () { > > > > > enable_interrupts(global); > > > > > enable_interrupts(int_rda); > > > > > puts("Running....\r\n", TRANS); > > > > > do { > > > > > delay_ms(10000); > > > > > printf("\r\nBuffered data => "); > > > > > while(bkbhit) > > > > > fputc( bgetc(), TRANS ); > > > > > } while (TRUE); > > > > > } > > > > > - > > > > > > > > > > Seems simple enough, right? Well I have 2 serial streams. > One > > > > > called TRANS, which is my wireless transceiver. GPS is > for... my > > > > > GPS receiver. In my void serial_isr() function, if I change > > > TRANS > > > > > to GPS, well... it doesn't seem to buffer. > > > > > > > > > > Any ideas? > > > > > > > > > > > > > > > to unsubscribe, go to http://www.yahoogroups.com and follow > the > > > instructions > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > to unsubscribe, go to http://www.yahoogroups.com and follow the > instructions > > > Yahoo! Groups Links > > > > > > > > > > > > > > > |