Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

trouble with sync....

Status
Not open for further replies.

Mr CCE

New Member
Hi all,

I've been working on transmitting and receiving bytes between 2 microcontrollers and for the next step I'm going to connect my RF modules.

but first I'm having a lot of trouble with the syncronization pulses that I'm sending before the actual data.What I'm doing is that I'm transmitting the the byte through RB0 of the PIC16F877A, and right shifting so that all of the byte will be sent, with a 250 us bit duration (or 2 KHz clock frequency) as I'm connecting my RF module's transmit pin to RB0.

On the RX side, the receive pin of the RF module is connected to RB0 of the RX microcontroller, and accordingly the bits are leftshifted and finally inverted to obtain the original byte's value.

Now I applied it on a simulator and the code works pretty fine, however, when I apply it on the real thing, the output aka RX byte is a whole different thing!!!!:confused:

I think the problem is in the syncronization between Tx and Rx. I'm gonna post both of the programs, and I appreciate all the help I can get.

thx in advance.

regards
 

Attachments

  • Transmit test_.txt
    455 bytes · Views: 144
  • Receive test_.txt
    789 bytes · Views: 145
Did you mean to look for a 0 last rather than the 1? Are you sending a 1 0 1 0?

Your receive code looks like 1 0 1 and go read. From what I can make of it.
 
Last edited:
Usart...

Hi there,

I want to thank Mr. Nigel Goodwin for his tutorial.

Well I've started using the USART(or UART) and I've got something to ask.

If I send, using the SEROUT statement, a byte variable of value "64", and on the reciever side I use the SERIN statement to retreive it, and then display this variable on portc-already configured as output port- will I obtain the value 64 on portc?

what I've also done in the attachement is that I introduced a condition:

if the received byte is 64 then display a zero output on portC, otherwise display 170. However I'm always getting a 170 output, which means that the program doesn't recognize the 64 input.

I'll post the code I've written so far and if you could tell me what's wrong I'll greatly appreciate it.

thx in advance

regards.
 

Attachments

  • softUART testingRx.txt
    348 bytes · Views: 116
  • softUART testingTx.txt
    390 bytes · Views: 137
Usart...

Hi there,

I'm not yet using the RF modules, because it's better to finish the program and get it to work wired first and then the RF modules will be added.

Right now I've been just trying to send a value such as 64 using the serout statement and using portb.1 as the output pin and the serin statement with portb.2 as the input of the other mcu. The result is shocking. I'm obtaining 00111111 for all input values?!?

Plus would you please tell me what's wrong with my code Mr.Goodwin?

thx very much in advance.

regards.
 
done and .... done!

Hi there,

The USART thing is powerful!!! It worked!

My mistake was that I was using '#i' while actually placing the value of 'i' in a statement other than SEROUT, I should've input the value in the SEROUT statement all along! (I know it's a silly mistake but c'mon, I just learned about USART).

Now the next step is to introduce the RF modules.I'll get back to you after some experiments.

keep up the good work gentlemen!

regards.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top