packet streaming
Some thoughts to consider for your RF project (review from old posts)
1. When you connect to the receiver you are likely to get a lot of false triggering due to noise. Ans: set up a preamble (ie #1#) to make sure the data is coming from your transmitter and not a ....blender. You may also miss the first byte or two so send a string of 1's first (ie 111#1#.. then data).
2. The UART line is held high. I inverted the tx and rx end so the transmitter would not be on continuously. You unit tx unit may only turn on with a line change in which case you won't need to worry.
1. When you connect to the receiver you are likely to get a lot of false triggering due to noise. Ans: set up a preamble (ie #1#) to make sure the data is coming from your transmitter and not a ....blender. You may also miss the first byte or two so send a string of 1's first (ie 111#1#.. then data).
2. The UART line is held high. I inverted the tx and rx end so the transmitter would not be on continuously. You unit tx unit may only turn on with a line change in which case you won't need to worry.
-
- Posts: 243
- Joined: 28 Sep 2005 19:43
- Location: Romania
Thanks for your hints. But in this case there are just basic settings in question.1. When you connect to the receiver you are likely to get a lot of false triggering due to noise.
Hmmmm, it isn't. Only if you use a line driver, such as MAX232 or similar, but this is not the case.The UART line is held high.
An RS232 signal looks indeed "sitting" on high, but that is the live signal on the line. The PIC outputs non-inverted levels, which are later inverted by line driver into RS232 signal.
Regards,
thenoble66
--------------------------------------------------------------------
thenoble66
--------------------------------------------------------------------
My understanding of the datasheet(s) is that TX pin is held high until a start bit (0) is sent indicating the beginning of transmission. This also explains why the LED thingy is glowing when I set it up for USART transmission but pull the jumpers going to the Max232.thenoble66 wrote:Hmmmm, it isn't. Only if you use a line driver, such as MAX232 or similar, but this is not the case.The UART line is held high.
Also, please share your "basic settings" for error detection and false triggering.
My encoder outputs the USART code correctly. However, it is NOT assigning PORTA to the output. Do i have to use the "Button" command to read the logic levels? i.e. Button(&PORTA, 1, 1, 0)?
Encoder:
Encoder:
Code: Select all
void main() {
TRISA = 0xFF; // set PORTA to be input
// Initialize USART module
Usart_Init(600);
do {
Usart_Write(PORTA); // Send data via USART
} while (1);
}//~!
-
- Posts: 243
- Joined: 28 Sep 2005 19:43
- Location: Romania
drdoug is right. Sorry for not being precise.
This line is necessary before doing anything with PORTA as digital port.
Code: Select all
CMCON = 7; // Comparators off
Regards,
thenoble66
--------------------------------------------------------------------
thenoble66
--------------------------------------------------------------------
Fantastic! I got the USART code out of PORTB.RB2. I am yet to start the decoder chip, however I have a more urgent problem. It runs fine on the PIC board however when i try to transfer it over to a Breadboard it doesnt output anything. noble66, I wired it up the way you specified in your schematics, but there is no logic output whatsoever.
I tested the chip in the PIC board and there where no clock-pulses feeding into the chip so I must assume it is set to its own internal oscillator. Is there some way I can test this?
Thanxs again you guys for your support so far.
I tested the chip in the PIC board and there where no clock-pulses feeding into the chip so I must assume it is set to its own internal oscillator. Is there some way I can test this?
Thanxs again you guys for your support so far.
Definitely check that you are using the internal osc (under Edit Project) and make sure you have the proper power and ground connections (middle of the chip) which were not included in the schematic but is assumed a priori.
Also make sure you have included that pull up to RA5 or the chip will behave oddly.
Also make sure you have included that pull up to RA5 or the chip will behave oddly.
I think you want INTOSC_OSC_NOCLKOUT as your oscillator. You can de-select the other items (for osc).
I also usually select MCLRE_OFF so I don't have to worry about the pull up on RA5.
I have not played with the RC osc mode but you can experiment with that once you get the unit working on a bread board (baby steps). The slower osc will save you power and it shouldn't mess up the UART since its in the hardware. Few components at this stage is desirable.
I also usually select MCLRE_OFF so I don't have to worry about the pull up on RA5.
I have not played with the RC osc mode but you can experiment with that once you get the unit working on a bread board (baby steps). The slower osc will save you power and it shouldn't mess up the UART since its in the hardware. Few components at this stage is desirable.
Last edited by drdoug on 22 May 2008 14:06, edited 1 time in total.
You should set your baudrate to 9600:
And you should consider using a crystal oscillator...
Code: Select all
Usart_Init(9600);
I've set my Baud rate to 4800 because 9600 may be too high for my RX/Tx radio units. you say INT_OSC but which one?
_INTOSC_OSC_CLKOUT
_INTOSC_OSC_NOCLKOUT
_INTRC_OSC_CLKOUT
_INTRC_OSC_NOCLKOUT
I would assume _INTOSC_OSC_NOCLKOUT but i think i tested that setting and it still didnt work. The other mehtods i have set by default are:
_HS_OSC
_WDT_OFF
_LVP_OFF
should I turn off _HS_OSC if i set an internal oscillator?
_INTOSC_OSC_CLKOUT
_INTOSC_OSC_NOCLKOUT
_INTRC_OSC_CLKOUT
_INTRC_OSC_NOCLKOUT
I would assume _INTOSC_OSC_NOCLKOUT but i think i tested that setting and it still didnt work. The other mehtods i have set by default are:
_HS_OSC
_WDT_OFF
_LVP_OFF
should I turn off _HS_OSC if i set an internal oscillator?
Make SURE you tested it in the EP board. This should be what you want and it should work in the breadboard as well. Does the RB2 light come on? - It should indicating the USART is initialized. You can even run it through the on board max232 to see if you get data from the pic using the terminal emulator.atommic22 wrote: I would assume _INTOSC_OSC_NOCLKOUT but i think i tested that setting and it still didnt work.