![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
Hello. I'm using Hi-tech PICC pro and PIC12F629. I want to make a simple usart communication subroutine: I've set Timer0 to make an interrupt every 250 miliseconds. In that interrupt I want to check whether there's an incoming byte from RS232. If there isn't - exit the interrupt and resume normal work. If there is - read the byte in a variable, and start a dialog subroutine. The thing I can't make is the interrupt - how do I check if there's an incoming byte, when I use the soft usart?
__________________ "Humans are stupid." | |
| |
| | #2 |
|
Can't help you with C, but a 250mS timer routine would be useless, you could (and would) miss loads of data in the 250mS. If you want interrupt driven routines then best to choose a PIC with a hardware UART, otherwise you need to check for the presence of a start bit VERY much more often, depending on baud rate. A software option would require an interrupt as the start bit begins, which could be done if the PIC supports interrupt from a pin change - this is usually available on PortB (interrupt on change on portb). Check the datasheet, see what the 12F629 has got. | |
| |
| | #4 |
|
Hmm, OK. Today I thinked about it and figured out a way how to make it without an interrupt. Thank you for the help anyway
__________________ "Humans are stupid." | |
| |
| | #5 |
|
You should be able to do it without interrupts. You just need to detect the start bit and then clock in data bits by sampling them in the middle of each bit. Sorry I can't help you out with your particular version of C. | |
| |
|
| Tags |
| interrupt, pic12f629, soft usart |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Anyone Using a PIC12F629 and C? | mrmonteith | Micro Controllers | 16 | 23rd March 2008 06:27 PM |
| PIC12f629 + motor | nuttaphong191 | Electronic Projects Design/Ideas/Reviews | 1 | 27th May 2007 01:18 PM |
| ARGH! PIC12F629 help please =D | Peter_wadley | Micro Controllers | 37 | 27th May 2007 05:58 AM |
| AVR USART by software? | MrMikey83 | Micro Controllers | 1 | 15th March 2006 10:02 PM |
| software usart | Ricardoco | Electronic Projects Design/Ideas/Reviews | 13 | 30th November 2005 12:14 AM |