Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:13 07 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : How to drive 13 relays.

     Page 2 of 2    
Author Message
Paul_L
Guru

Joined: 03/03/2016
Location: United States
Posts: 769
Posted: 08:44pm 27 Dec 2016
Copy link to clipboard 
Print this post

  robert.rozee said   you could just connect up to the console, leaving the remote micromite sitting at the command prompt, and send text commands of the form:
PIN(n) = value

no programming at the remote end is required, and even an MX150 would do the job just fine.

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: Australia
Posts: 6269
Posted: 09:22pm 27 Dec 2016
Copy link to clipboard 
Print this post

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 States
Posts: 769
Posted: 09:23pm 27 Dec 2016
Copy link to clipboard 
Print this post

  TassyJim said   Paul,
6 meters (I use metric to confuse you) is short for RS232.
I use MAX2323 modules at each end to give better noise immunity than TTL.
If you use the console port on the 'remote' micromite, you can easily get to the 'local' end and switch it from the master micromite to a USB adapter and program it without having to pull the house apart.
You just have to be careful that your program doesn't send a ctrl-C while running.

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 Kingdom
Posts: 2170
Posted: 11:09pm 27 Dec 2016
Copy link to clipboard 
Print this post

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.

cheersEdited by CaptainBoing 2016-12-29
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 11:35am 28 Dec 2016
Copy link to clipboard 
Print this post

  Paul_L said  
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


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 Zealand
Posts: 2430
Posted: 10:38pm 28 Dec 2016
Copy link to clipboard 
Print this post

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: Australia
Posts: 1982
Posted: 01:03am 29 Dec 2016
Copy link to clipboard 
Print this post

  Quote  Much worse than a wet day at the cricket.

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: Thailand
Posts: 2209
Posted: 02:22am 29 Dec 2016
Copy link to clipboard 
Print this post

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 States
Posts: 769
Posted: 04:38pm 29 Dec 2016
Copy link to clipboard 
Print this post

  TassyJim said  Much worse than a wet day at the cricket.

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: Australia
Posts: 935
Posted: 06:33pm 29 Dec 2016
Copy link to clipboard 
Print this post

What's snow?
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 09:45am 30 Dec 2016
Copy link to clipboard 
Print this post

  Paul_L said  
  TassyJim said  Much worse than a wet day at the cricket.

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

NO, just different coloured balls.

  Quote  What's snow?


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 States
Posts: 769
Posted: 01:35pm 30 Dec 2016
Copy link to clipboard 
Print this post

  BobD said   What's snow?

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
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025