Is it going to work?
kymppi
Posts: 5
I have 16 push buttons in hand-held control device and I have been looking for a solution to convert these 5V TTL signals from parallel to serial and back again on the other end of the cable. Multiplexing is out of question and "normal" parallel to serial to parallel IC's don't work as needed. At least 74hct164 and 74hct165 doesn't work right way.
So is it going to work if I put those 16 signals to this Basic stamp module as inputs and it sends the data from Tx to Rx on other Basic stamp module and it convert it back to 16 outputs?
These modules should work without computer and wake up after power loss and continue working. Does it need any backup battery or something like that to keep programmed data in memory? It would be great if these modules work with 5V, but that's not a problem. Next problem will be programming this thing if it is suitable for this application.
Thank you for your help.
kymppi
So is it going to work if I put those 16 signals to this Basic stamp module as inputs and it sends the data from Tx to Rx on other Basic stamp module and it convert it back to 16 outputs?
These modules should work without computer and wake up after power loss and continue working. Does it need any backup battery or something like that to keep programmed data in memory? It would be great if these modules work with 5V, but that's not a problem. Next problem will be programming this thing if it is suitable for this application.
Thank you for your help.
kymppi
Comments
Using the Stamps, one at each end, is simpler from a hardware standpoint. A Stamp has 16 I/O pins (except for the BS1 which has 8 and the BS2p40 which has 32) plus the programming pins (Sin and Sout) can be used for asynchronous serial I/O. They can work with either a 5V regulated supply or a 6-9V unregulated supply. They have an EEPROM which holds the compiled program and will just start up that program when they're turned on.
There's lots of information on Parallax's website available for download. I'd suggest starting with the "Basic Stamp Syntax and Reference Manual" and the "What's a Microcontroller?" tutorial. Go to the main Parallax webpage and click on the Resources tab, then follow the Downloads link. You'll see some other links. The Stamps in Class Downloads link will take you to an index of all the tutorials and the BASIC Stamp Documentation link will take you to the Manual.
Read the Manual's chapters on the SERIN and SEROUT statements and the DEBUG and DEBUGIN statements. There's also a chapter that describes how the I/O pins are accessed as 16 bit variables (INS, OUTS, DIRS).
Why I'm trying to this is because I need to install a LCD display to this hand-held control device and there is not enough free wires in the cable so that I could easily do it. So I need to free up some wires, because cable manufacturers won't make me a bigger cable because of small order amount and high price. I have 37-pole cable and there is one free wire. It is spiral PUR cable.
I have understood that I can't use multiplexing since there can be many inputs on at the same time. I could use multiplexing with two rotary switches, because there is only one position selected at a time. Ok, I have two rotary switches (4-position and 6-position) and 6 buttons. Two buttons are some times pressed at the same time, so four inputs out of 16 can be on at the same time. There will be two more buttons added later and then BS2p40 would be a great choice.
I have tried to make a circuit with 74hct165 and 74hct164 converters and either I can't make it right (possible, almost sure) or it doesn't work right. I managed to send 8 bit dip switch code from 74hct165 to 74hct164, but there is a problem in outputs. It seems to put first output on and then it moves it to the next output in every clock pulse. It's "running" effect. Those outputs should be steady. If I put one switch on, then corresponding output should be on immediately and that's it. If I put three switches on, then there is supposed to be three outputs on etc. I need to send these outputs to PLC and it will not work if outputs are going on and off like maniac. It will cause a disaster in the machine.
And I'm trying to find as simple and easy solution as possible. I haven't been working with multiplexers or microcontrollers before. I haven't programmed either, except that LCD display. I desided to control it with PLC, because it's simple to just send hex codes to it and I need that PLC to handle measuring devices too. So it's not programming after all.
But I read some manual about this module and quickly it seems promising. I'm eager to learn something new, but it's always better if someone who already knows something about this product can tell me if this is what I can use. I don't see the point just ordering some stuff and then after many working hours find out that this is not going to work. If this module is not ok for this purpose I don't see other way but going to some company and order this whole thing ready. Since they decided in UK that they won't send their products to Finland. There is also one ready module at Tronisoft, but they have made their decisions about shipping outside UK.
Thank you anyway. I'll read some more about this product when I'm going to bed. I hope my girlfriend will understand it if I'm interested about something else tonight.
On the receiving end it could be as simple as the following, which waits for data to come in at 2400 baud and transfers it to the output pins to your PLC.
That is PBasically all that is required. Enhancements are possible, such as to transmit data only when switches change state. Snd if there is possibility of transmission error (noise coupled from other lines on the cable), then error checking and recovery may be advisable, and the Stamp can handle that, whereas a dumb shift register cannot.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
And yes I get 5V signal from switches when pressed and 0V otherwise.
I have no idea what that program says, but when I start to study maybe it will open up for me. Maybe I can try this on Proteus simulation.
And how many wires this connection between two stamp require?
Thank you again.
kymppi
The input pins are captured or activated as two groups of 8 inputs as INL and INH. Similarly for OUTS, OUTL and OUTH. The program is simply reading those pins and sending them out as arguments in a serial output command:
SEROUT 16,396,[noparse][[/noparse]INL, INH]
The pin to use for output is p16, which is the dedicated programming and debugging port on the Stamp, above and beyond the normal i/o pins, which are numbered p0 to p15. The value 396 sets the baudmode parameters, here 2400 baud, but there may be reason to choose some other baud rate. The matching command,
SERIN 16,396,[noparse][[/noparse]OUTL, OUTH]
receives the two bytes that were transmitted and transfers them directly to the 16 output pins. DIRS=$FFFF sets all 16 of the pins as outputs (The default is inputs). In this scheme, there will be a few milliseconds of delay between updating each group of 8 pins. If that is a problem, there are easy ways around it. The idea though is that you can probably get it to do what you want. And there is help here on the forums.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 4/19/2009 9:22:26 PM GMT
Thank you all. I will try this and if I have any further questions I will post them here.
Best regards,
kymppi
Correction to previous posting: physical pin 4 on the transmitting stamp to physical pin 3 on the receiving stamp.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
·
You want to encode the data into as few wires as possible and then decode it on the other end for display on LCD.
·
You have 37 wires.
·
How many wires are you using for your LCD?
“Standard “ parallel LCD can be run with roughly 10 wires – including backlight and control signals.
·
·
Your data should be encoded for proper display format. (No extra decoder needed at LCD).
·
I bet you could find I2C chips / chips to interface with LCD – and now we are talking about 2 to 4 wires plus power. (That would be my choice)
·
Not be picky – but any serial communication (RS232, I2C) is form of multiplexing and to be picky – it cannot be used “continuously” – it is a shared communication.
Cheers
Vaclav
·
·
·
I don't need to send data to LCD. All I need is to get 16 signals (in near future about 20 signals)·from switches to PLC. I need only one direction connection from hand-held device to PLC.
LCD is working with serial connection and is controlled by other PLC.
Yes I guess serial communication·is one form of multiplexing. I just need the·right kind of multiplexing and don't know how to do it with separate IC chips. By continuos I mean that connection is alway on. Not that it will turn on by every time some switch changes state.