PIC16F877A RS232 running at 38400bps

Status
Not open for further replies.
Page 9 of datasheet mentions

2.4 Data interface
SZ05-ZigBee Wireless Module has standard interface of RS232, RS485 or TTL in the hardware. Serial
RS232 includes TX2, RX2 and GND. RS485 contains TX2(A+), RX2(B-). TTL interface is TX1 and RX1,
and the level of TTL is 3.3V

TTL TX1 and RS1 are the 3.3V TTL pins. It has to be cross connected to PIC UART Rx and Tx pins. Zigbee RS1 to PIC Tx and Zigbee TX1 to PIC Rx. You can't directly connect it to PIC as PIC is 5V TTL device. See if you can power the PIC with a 3.3V power supply. If yes, you can then use the above connection else if PIC doesn't run at 5V then you need a voltage level translator between Zigbee 3.3V TTL pins and PICs 5V TTL pins.

Another method is to use Zigbees RS232 pins (TX2, RX2) to connect to PIC UART pins. For this A MAX232 is needed. MAX232 circuit is provided in MAX232 datasheet. If you don't want to use MAX232 you can use RS232 to TTL Converter. Connect the RS232 side of converter to Zigbee RS232 port and TTL side to PIC. Whether you use RS232 ot TTL the GND pin of Zigbee should be connected to PIC circuit ground.


Have you configured Zigbee properly?
 

Finally I managed to make the right configurations of the Zigbees. I use MAX232, I use 5 Volts as company told me, and I send correctly characters from the PIC-Zigbee to PC-Zigbee, but when nothing is send, strange characters appears.

When I plug off the Zigbees, the PC-Zigbee still get data (which I can see to the putty)!!!!!!!!!

Also,is it possible a Zigbee supplied by 5 Volt, to handle RS232 12 volts in pins TX2,RX2?????
 

Pins TX2 and RX2 of Zigbee are RS232 pins. You have to use MAX232 between these pins and 5V TTL UART pins Rx and Tx of PIC. You can use RS232 to TTL converter between PIC and Zigbee.

**broken link removed**

Are you reading the right COMx port in putty ?
 

I use the MAX232. Yes I read the correct port. Could these strange numbers be some kind of noise of the Zigbees?
 

How many software UARTs can I use in a PIC microcontroller??
 

hello,

If you want connet the PIC to Zigbee, TX1 and RS1 are the correct pins
TTL level,but if zigbee power supply is 3,3V and PIC supply is 5V
you must use level converter
PIC output TX 5V level ---resistor 1K -- RS1 Zigbee Rx input
PIC Input RX 5V level <------------------ TX1 Zigbee TX output

And use a MAX 3222 instead of MAX232 for the PC Link
 

Why MAX3222?
 

hello,





Interconnection with 3V and 5V Logic
The MAX3222/MAX3232/MAX3237/MAX3241 can
directly interface with various 5V logic families, including
ACT and HCT CMOS. See Table 3 for more information
on possible combinations of interconnections

see MAX3222. datasheet for more explanation
 
When I use the RS232 of the development board, I can send successfully data from one zigbee to the other. But when I use the RS232 circuit on the breadboard ( and not the development board ), the MAX232 becomes hot, and strange characters are displayed on the terminal. The circuit I use on the breadboard is shown below. Do you see anything wrong ????
 

Attachments

  • rs232circuit.jpg
    82.2 KB · Views: 77

Have you configured the baudrate of Zigbee and also your PC COMx port of USB (Virtual COMx) port to the same baudrate as set in MCU code ?
 
Have you configured the baudrate of Zigbee and also your PC COMx port of USB (Virtual COMx) port to the same baudrate as set in MCU code ?

Yes both on 38400bps with 16Mhz crystal
 

Post your exact circuit and zip and post complete project files.
 
This is the schematic of MAX232 of the development board as corrected by paulfjujo. When I use the PIC16F877A on the development board, the characters sent by the zigbee are ok. When I use the circuit ( that I attach) strange characters appear. Don't get confused of PIC18F452, I use PIC16F877A, the pins needed are the same.
 

Attachments

  • schematic_PIC16F877A.jpg
    200.4 KB · Views: 78

hello

We don't know if SND (Gnd for RS232) is internally linked to Gnd
so try to connect SND (pin24 ?) to GnD
Gnd Zigbee must be the same Gnd as for PIC !
 
hello

We don't know if SND (Gnd for RS232) is internally linked to Gnd
so try to connect SND (pin24 ?) to GnD
Gnd Zigbee must be the same Gnd as for PIC !

I try it! It stops sending characters!!

Do you have any reliable schematic for MAX232 that have worked for you??
 

On Zigbee doc
TX2 RX2 pins are noted RS232/RS485 !
we suppose you have RS232 modele , not RS485 !

Try also to change capacitor 10µF by 1µF ! on Max232
 

On Zigbee doc
TX2 RX2 pins are noted RS232/RS485 !
we suppose you have RS232 modele , not RS485 !

Try also to change capacitor 10µF by 1µF ! on Max232

Yes they can be used also for rs232.
Ι used 1μF. Nothing worked!Again strange characters.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…