USB & Serin

Tasp

Member
Is it possible to use AXE027 with the Serin port?

I have it working to download to my 40X2 but don't seem to be able to send data to the chip using the serin command even when the chip is waiting on pin 6.

So there's no point trying to send data if I know for sure it's not compatible.

Just wondered if anyone has tried or whether it has to be RS232 only, the manuals don't seem to cover it.

Cheers
 

Janne

Senior Member
Hi,

Another possibility would be to use serrxd, and the download header itself to receive the data onto the 40x2.
But there should not be any reason why it should not work with normal input pins aswell, if you have your circuits set up right, that is.
 

hippy

Technical Support
Staff member
It should be working, but what exactly is "pin 6" on a 40X2 ?

If you mean Leg 6, the download Serial In, then you should use the SERRXD command.

If you mean some other pin you should be using SERIN with the pin to use specified as port.number, for example B.6, C.6 etc.
 

Tasp

Member
Ok leg 6, so SERXD will wait but only on the Serial In leg(6) But SERXD doesn't seem to accept different baud rates (from what I understand from the manual).

Just to clarify.

The program running on the chip is waiting using the SERIN command on leg 6 for data send via the AXE027 usb lead, if the data is "A" then b.7 goes high, if "a" then b.7 goes low.

I'll go away and try SERXD.

thanks
 

hippy

Technical Support
Staff member
Yes, fixed baud rate is one of the limitations in using SERRXD. That will be 9600 baud if you have not used any SETFREQ commands.

The following uses the Programming Editor Terminal display and should echo back what's in the Input Buffer whenever the Sent button is clicked -

#Picaxe 40X2
#No_Table
#No_Data
#Terminal 9600
SerTxd( "Ready", CR, LF )
Do
SerRxd b0
SerTxd( b0 )
Loop

I'd recommend getting that working successfully before moving on to do more complicated things.
 

MPep

Senior Member
@Hippy,
This relates to the previous post of http://www.picaxeforum.co.uk/showthread.php?t=14952.

@Tasp,
Once you get this working (SERRXD @ 9600), then speed up using SETFREQ. Your application, switched outputs, should not need to be limited to baud rate. In fact, given the fact that you could daisychain as many boards as you want, then faster may be better.
If controlling many boards, then the multiple listener/single talker situation may be more appropriate.
If the (many?) boards are some distance apart from each other, then maybe look into RS422 interface.
 
Last edited:

Frank42

New Member
I'm a sad, old nit-picker, so I was upset by the errors in your "footer", or whatever it's called. Please sort out your "your and you're" and "there, their and they're". I just want everyone to "get it right".
 

Dippy

Moderator
Well, if you have a spare couple of weeks then you'll find zillions of grammatical errors.
It's like painting the Forth bridge.

Lose and loose is a favourite :)
 

MartinM57

Moderator
I'm a sad, old nit-picker, so I was upset by the errors in your "footer", or whatever it's called. Please sort out your "your and you're" and "there, their and they're". I just want everyone to "get it right".
Well I must be a sad, old blind nit-picker then. What footer? What errors? What day is it? Are we nearly there yet?...

Welcome to the forum Frank42 :)

We can now call grammatical errors "Frank42s" (or should that be "Frank42's"?)
 

Tasp

Member
Many Thanks To All.

Thanks to Hippy's code I saw the floor in mine, the "echo" program worked straight away and showed where I was going wrong with my SERXD command.

PCB was fine, program was the issue. Human error again!

Also I had no idea Terminal was there. Was trying to find hyperterminal for vista which isn't there anymore.

Didn't mean to cross post, however this originally started as a USB serial question and wasn't originally supposed to be related to my previous posts.

There will no need for RS422 all chips will be on the same board however the original concept was for the first chip, if the message was not for it then to send onto the next via an output pin/leg, however MPep your quite right there is no need to send from one to another they can all listen on the same Serial In pin/leg and that would free another output. Also I didn't see your last post on the other thread for some reason I've stopped getting email notifications of replies?
I do not see a problem with the programs main part if multiple chips are listening?

I believe "Frank42" is refering to my signature, it should read;

If you're ever being chased by a police dog, try not to jump through a fiery hoop, over a see-saw and through a tunnel. They're trained for that stuff!

However I refuse to!! I don't want to "get it right" I want to be an individual ;0)
 
Last edited:

MPep

Senior Member
There will no need for RS422 all chips will be on the same board however the original concept was for the first chip, if the message was not for it then to send onto the next via an output pin/leg, however MPep you're quite right there is no need to send from one to another they can all listen on the same Serial In pin/leg and that would free another output. Also I didn't see your last post on the other thread for some reason I've stopped getting email notifications of replies?
I do not see a problem with the programs main part if multiple chips are listening?
Yep, it all depends on how many chips you planned on controlling. Didn't know it was only for 2. It could have been upto 36 (A-Z and 0-9) :eek:. Now that is a serious amount of output control.
In my program, if not intended for THAT chip, then it will send through SEROUT. If you don't require this, then you would need to change the subroutine, or better yet, remove it altogether :).
The extra character could be used for PWM control if required. Just a thought.:D
 

Dippy

Moderator
"However I refuse to!! I don't want to "get it right" I want to be an individual ;0)"

- absolutely Tasp and why not! ;)

However, I can see a floor ("flaw" by the way), it means you are like most other people i.e. can't spell ;)
 

MPep

Senior Member
However, I can see a floor ("flaw" by the way), it means you are like most other people i.e. can't spell ;)
That is of course the other way to interpret the said sentence. And also the Conformist way, something Tasp wants to buck.:eek:
 

Tasp

Member
Yes, not strictly a spelling mistake but more a definition problem! There's quite a few on this forum, but I suspect it's mainly caused by the speed on replies and typing rather than a lack of education.

Anyway, I only intend to use 40x2 chips x 5 on the same PCB with ULN2308A Darlington drivers as the outputs, so now have removed the sending part of the code from the program, and it just now checks if the message is for that chip ie "A" or "B" etc if not then sits and waits for the next command.
I assume there is no additional other components needed for multiple chips using the same serial in? All will need the standard 10k 22k download resistors but seen as no serial out no diodes.
 

hippy

Technical Support
Staff member
I assume there is no additional other components needed for multiple chips using the same serial in? All will need the standard 10k 22k download resistors but seen as no serial out no diodes.
If it's driven from a PC you should only need one 10K and 22K download circuit, it should be possible to connect all Serial In pins together. Breadboarding, prototyping and testing is the best way to confirm that.
 
Top