SERIN gone mad?

Hi guys.
I was just trying a simple serial comunication between my 28x1 and my 28a picaxe chips. I directly connected an output pin of the 28a to the input of the 28x1 (as some site suggested)and i have tried to transmit at N600 and N2400.

this is the code for the 28x1 (SERINner)

debug
let dirsc = %00000000
main:
serin 0, N2400, b1
goto main


what happens is that, even if the 28a is left unpowered (= no one SEROUTing) the 28x1 still gets odd values and stores them in b1, doing that continuously (looping). When i disconnect the wire attached to the input port the values become 0 (even if the system continues to loop). If i touch the male header of this input pin, i again get the previous odd results continously.

I already read various posts around but none seem to talk about this. My guess is that i need some resistors but i have no idea whether this is true or not. Please help me :=(

Thanks!
 

eclectic

Moderator
Cap'n Antenna.

First quick response;

Ground / tie ALL unused inputs to 0v, using a 10k resistor for each pin.

Are the resets connected via 4k7 to V+ ?

e
 
Last edited:
Antenna? :=)
in fact i forgot to ground them with the 10k resistor, that is because i am not using the picaxe board so i left them all floating, thank you. The resets are connected, else it wouldn't work!
 

eclectic

Moderator
Sorry for silly attempt at pun.

When you touch the pins, you are an antenna,
conducting all sorts of RFI / EMI signals.

Have a search of the Forum, using the three terms

input* unused ground

Loads of info and explanations.

e
 

kranenborg

Senior Member
Inputs will generally have very high impedance (and I presume that this is also the case when SERIN is applied), which implies that when nothing is connected (that includes a non-powered device as the output drivers transistors are inactive and closed) any voltage can be present, which will result in "garbage" read.

If you do not want this you could use a pull-down resistor (pull down since the N in the N2400 statement indicates a low default level) of 10K - 100K to cure the problem.

I do not see why other floating inputs should have any influence (although grounding them is generally good practice)

/Jurjen
 
no more bad readings with the input grounded. But still the serial transmission doesn't work. But that's another problem, and there are lots of threads out there about serial communication.

Thank you guys!

Captain Tuna, or Captain Antenna (with floating inputs) :=)
 

kranenborg

Senior Member
Wait a minute ...

I just noticed the LET DIRSC command ...
This may cause portC to be activated, and that may cause the serin command not to work as the pins are not "normal" pins anymore (PORT A, i assume)

I you remove the LET command it might work as the pins are already standard input pins at power-up.
I do not have a working 28X1 circuit so I cant check myself

/Jurjen
 
i am not using the dirsc anymore actually, because i am trying to receive with the 28a so i don't have i/o pins to care about. This 28a chip seems to work correctly, as when i try to upload a new program i have to reset it because of the SERIN command under execution.

Problem is nothing gets received by it, the debug doesn't show anything and the chip, as said before, needs a reset for a new program. So i think the problem is now with the transmitter (28x1) which is on a board i made myself. It only has the download circuit, a resonator, and the reset pin high. it used to work for lighting up leds but doesn't seem to work for SEROUT.

This is the code for it:
let b1=132
serout 7,N2400, (b1)

So....it's not about the dirsc!
 

kranenborg

Senior Member
You could check at the sender's if anything gets sent by puttting a LED and resistor at the output, and then use a slow (N600) Serout sending a long string, and then see whether the LED flickers ...

Another issue: Aren't you sending too hastily? Put a 1sec pause before you send, and then check whether you receive something (serin will be waiting until some message arrives).

/Jurjen
 
Re-tried everything but still not working. However when i disconnected the sender, the receiver debugged a "255" value from the SERIN, what could that mean?

EDIT: no wait, it also happens when i touch the ANY male header of the sender with the wire (connected to the SERINner),
 
Last edited:
here they are.
I've also tried using N2400 and inverting the sender/receiver (picaxe 28x1 receiving, picaxe 28a sending, only the code and pins used would change)

 

ValueAdd

Senior Member
Have you conencted the 0V together between the two systems?

You need that 0V common connection as a reference for the signal between the two PICAXE.
 

Attachments

Last edited:
oh noes! I haven't done that but i was planning to use the serial communication together with IR as some guys suggested here. That way i won't be able to tie both grounds together.

Shall i abandon the idea of using serial communication with IR?
 

eclectic

Moderator
Cap'n.

Try something like
Code:
Main:
for b0 = 1 to 255

serout 7, n600, (b0)
pause 1000
next

goto main

'rx

main:
serin 0, n600, b0
sertxd (#b0, cr,lf)
goto main
edit.
IR comms won't require common ground.
 

westaust55

Moderator
oh noes! I haven't done that but i was planning to use the serial communication together with IR as some guys suggested here. That way i won't be able to tie both grounds together.

Shall i abandon the idea of using serial communication with IR?
You need the mentioned 0v conenctions on both systems connected when you are using a copper (wire) based signal. The electrons (amps) need a return path (loop) to complete the electrical circuit before any wired circuit will function.

If you have say an IR diode as the transimtter connected to an output then the diode goes to ground to complete the circuit. Likewise your IR detector at the receiving end will say connect from 5V to the PICAXE input so there is a complete electrical loop.

The unlike the wired circuit, the IR transmission does not require a "return" path. The IR dectector reacts to the IR signal and acts like a switch passing electrons to the PICAXE input which detects the high or low state accordingly. So when you advance to using IR for the ink it will work without the 0V rail on each board being conencted
 
Last edited:
thanks for the explanations, i understood everything! And yes, it does work now (same code as before but with common ground)!how cool!

Now to the next step, IR with serial! :)

Thank you for your help guys, i really appreciate it. Not only it makes my stuff work, but i also understand why it works that way, and that's fundamental if i want to go a step further. Thank you! :)
 
Top