Serial TTL with 20X2.

Emile

Senior Member
Hi everybody ,

I try to use a pair of transmitter / receiver with a PICAXE 20X2 , but this does not work ...

Only the receiver has a serial link. the transmitter do not have a serial link.

The code I have tried without results : I have put the SERIAL pin of the receiver on the input B.6 of the 20X2

main: serin B.6,N9600_8,b0
debug
goto main


Who can help me to use this serial link ?

Best regards and thanks for all :) !

Emile
 
Last edited:

PerthEng

Member
I think that you will need to provide a link to the website where the datasheet for the transmitter and receiver modules can be found before too many here can help you.

Your English is better than my French so no problems there. :)
 

MFB

Senior Member
I agree that we probably need more information before being able to help but you could try using 'T' rather than 'N' for serial out.
 

Emile

Senior Member
I have done a test with

main: serin B.6,T9600_8,b0
debug
goto main


I have used the usb cable for the debug test.

Here is a link of a movie that i have made now.


As you can see , i can have value on b0 but its always the same ...

When there is no transmission the value of B0 is 0.
When there is a transmission ; when i put input 1 of the transmitter at value 1 , the value is 58 on B0
when i put input 3 at value 1 , i have 58 too ...?

Emile
 
Last edited:

Technical

Technical Support
Staff member
If you get 58, all is working correctly, as 58 is ASCII of the character ":", which is always the start of the reply.

If you want the 'no serie' this is the 4th byte so use a ":" qualifier and then the third byte after this.

main: serin B.6,T9600_8,(":"),b1,b2,b3
debug
goto main
 

westaust55

Moderator
Looking at your video clip it seems that the actual radio part is working correctly.
When you operate input 3, the LED for output 3 illuminates
When you operate input 6, the LED for output 6 illuminates
In both cases the "S" LED illuminates to indicate correct data transfer.

So the problem is to work out what is happening with the serial data.

from the image
en-tete de trame = start of screen
fin de trame = end of screen

there appreas to be a colon, a 5 digit value and then the state of the outputs.


58 = $3A = a colon ( : )

From this I believe you need to read three bytes of data for each entry

The T9600 part is therefore correct.

Try
main: serin B.6,T9600_8,b0, b1, b2, b3 ; b1 and b2 are the series word
debug
goto main

and look at b3
 

Technical

Technical Support
Staff member
It looks like you may also have TR00 jumper switch set 'off' so still getting a transmission when all inputs are off - change this to 'on' then you will not have any transmission when all the switches are off (page 10/11).
 
Last edited:

Emile

Senior Member
I have made new test and ... its running !!


I have just changed the code :


Here is a print screen of the result .

I have put the level 1 on inputs 2 and 5 and as you can see on the debug , its ok .

I want now understand the code :)

Thanks for all

Emile
 
Last edited:

westaust55

Moderator
If you try this version it may save you many variables:

Code:
main: serin B.6,T9600_8,(":"),b1,b2,b3,b4,b4,b6,bit7, bit6, bit5, bit4, bit3. bit2. bit1, bit0
debug
goto main
Then look at byte variable b0 to see all of the bits as one per switch.
If you do not want to record the series number which follows the colon, you could even change to

Code:
main: serin B.6,T9600_8,(":"),b0,b0,b0,b0,b0,b0,bit7, bit6, bit5, bit4, bit3. bit2. bit1, bit0
debug
goto main
 

Emile

Senior Member
Thanks Westaust for this very thanks !!

For the example :

main: serin B.6,T9600_8,(":"),b0,b0,b0,b0,b0,b0,bit7, bit6, bit5, bit4, bit3. bit2. bit1, bit0
debug
goto main


values are in the begining destroyed in to b0 ? Only the 8 bit coding is staying ?

Emile
 

westaust55

Moderator
Thanks Westaust for this very thanks !!

For the example :

main: serin B.6,T9600_8,(":"),b0,b0,b0,b0,b0,b0,bit7, bit6, bit5, bit4, bit3. bit2. bit1, bit0
debug
goto main


values are in the begining destroyed in to b0 ? Only the 8 bit coding is staying ?

Emile
That is the proposed idea.
 
Top