![]() |
Forum Index : Microcontroller and PC projects : How to drive 13 relays.
![]() ![]() |
|||||
Author | Message | ||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
Are you telling me that I can somehow connect an output pin of one uM to the console input of another uM and send text commands to the interpreter in the remote uM? Please explain further. This might be the optimum solution. Paul in NY |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
From the command line you can enter SETPIN 23, DOUT : pin(23) = 1 and pin 23 will go high PIN(23) = 0 will set it low again. The master MM can send anything over serial and the console port on the slave is standard serial. The slave doesn't know (or care) if it is you, the dog or a a hight being that is sending the commands. Not everything will work from the command line, but most will. Jim VK7JH MMedit |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
Hi Jim, It's easy to confuse a Polack. A meter could be a rhythm in verse (iambic meter), a rhythm in music (polka {a polka could be a dance or a female polish person whereas a polak is a male polish person}, schottische, waltz), or a gadget to measure something (voltmeter). A metre, on the other hand, is 10E-07 times the distance from the equator to the pole. I think you meant the MAX3232 RS232 line driver, not the MAX2323, a CDMA mixer used in cell phones. Are you telling me that if I control the remote uM through its console port by sending text formatted basic commands to it from the master uM, I can then disconnect the master uM and hook it to a USB adapter in order to load a new program into the remote uM? It I am controlling the remote uM by sending it's interpreter immediate text commands then it will be running without any user program installed but just interpreting commands as if they were from a console. Under this circumstance why would I ever need to load any program into the remote uM? Paul in NY |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
Hi Paul, I did have a good Xmas thanks - hope you did too. I am a bit late to this thread but it is a nice one. On the original requirement to drive a load of relays from a small(ish) number of pins, you can maximise your effective driving capability with the shift register idea as already put forward here. Roman Black has a really nice article on this with only a single pin(!) the only caveat being some ripple or only being able to drive seven bits per byte. Anyway, have a look at this article to get you started (his site doesn't seem to be maintained much recently but you are gonna lose hours here :o). http://www.romanblack.com/shift1.htm On the subject of driving the remote uM via commands down RS232, you have 3 serial ports (not including SPI & I2C) - com1, 2 and the console so driving one uM from another is a matter of having code at both ends and interpreting the messages between them. It is, as already mentioned, trivial. That said, I would recommend against having zero code at the remote end and issuing MMBasic commands directly, yes it will work but it has the potential to get in a horrible mess and if you are switching anything important with your relays, do you want to take that chance? I recommend you write a simple monitor that can at least stay running and provide a level of cover for errors/mistakes. It doesn't need to be anything fancy - simple checksum of the command so you know what you received is probably genuine. Once you have it done there won't be much need to visit it again. Have fun and let us know what you end up with. cheers |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
Using the command line doesn't give you any way of doing any checking. A misread command could do undesirable things. Much worse than a wet day at the cricket. If you 'reset' the MM, all outputs will go high Z and you will have to go through all the outputs, resetting them to outputs and the required state. Much faster to do with a program installed on the MM and set to autorun. Being able to do the command line either from a master MM or a terminal program makes it easy to try test sequences. Being able to switch the serial line from the master MM to a terminal program makes program update easier. Jim VK7JH MMedit |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2429 |
i would have thought it would be easy enough to use a 2-way link; if the response to any given command is the ">" prompt, then you can be fairly sure it was understood by the remote micromite. it would also be possible to read back the status of any pin after it has been changed with a PRINT PIN(n) cheers, rob :-) |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
They just shouldn't play cricket in Melbourne. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
The same can be done by using INPUT and INKEY$ statements. They get the data from the console pins, saving you two pins. A little program can then check the input and act and respond accordingly. This little program can then also ensure through the use of a watchdog and auto startup that the relay outputs are in their intended states. Microblocks. Build with logic. |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
OK, we're back to cricket again, huh. Is it true that you guys have different rules for cricket and rugby depending on whether it is clear, raining, or snowing? Paul in NY |
||||
BobD![]() Guru ![]() Joined: 07/12/2011 Location: AustraliaPosts: 935 |
What's snow? |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
NO, just different coloured balls. There was some visible from my kitchen window last week! Must have been there for Santa. Jim VK7JH MMedit |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
I'm not sure anymore. We haven't seen hardly any this year. Everything out there is green! It's supposed to look like this. I miss it. Paul in NY |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |