Decision based on output state?

RoSi™

New Member
Hello,

I am just trying to draw simple program using Logicator Flow Chart on 18M2, where I need a decision based on state previously set output pin.

Can I somehaw read the status of Output pin and continue with decision? :confused:

Or, if it is possible in BASIC code, please how?

Thanks.
 

hippy

Ex-Staff (retired)
Welcome to the PICAXE forum.

With Basic code you can use the READOUTPUTS command or the 'outpins' variables where available; outpinsB and outpinsC on the 18M2.

For Logicator it's probably best to use another variable to track what the output state is; so if you set an output high set the A variable to 1, set the output low, set A to 0.

In many cases it isn't necessary to check the outputs to see what state they are in and it can be argued that often points to a deficiency in the overall program. If you let us know what you are attempting to do there may be a better approach you could take.
 

RoSi™

New Member
First of all, I've managed to do the decision using the variable increasing/decreasing + some eeprom writes/readouts.

Thank You for the advice.

I know, that in many cases is not necessary to read the output states, but my head stopped to work just after the word ''necessary''.

Therefore I'm open to any comments/tips & hints to improve software for my project, which will be used as harddrive switch/selector in file server.

Let me explain:
Imagine that You have PC with 4 drives (we don't count the system-boot one) and this circuit/software will provide selection of drives (which to run) prior to powering on the server with some:

* fool-proof protection (to not turn the drives on/off while the system is running)

* status indication:
- RED LED: hard drive is off
- GREEN LED: hard drive is on
- YELLOW LED: status change requested, while the system is on (in this case switchover will be executed after the pc is turned off (+Vcc drops))

* control button (one per channel) with command delay (will do anything after holding down for 1s)



I still have to figure out where to connect RED LED, as I've run out of outputs on the chip, but I am sure I can feed it somehow through the inverter opposite 5V branch (maybe).

I've choosen 18M2 chip because it can run 4 separate programs, therefore I can have 4 separate channels.

I know, there might be a way to run it for 4 (or evenmore) channels without multi tasking, but my head is refusing any cooperation.

If You, or anyone else have an idea, how to extend it for 8 channels without adding another chip, please let me know.

Any help, or comment will be much appreciated.

 

Attachments

Last edited:

hippy

Ex-Staff (retired)
For your red LED ( drive not on ) you could use a DPDT relay and switch +5V to the red LED when it's not switched to the yellow LED.

In order to get help going to 8 channels you will likely have to describe the functionality of the unit as a whole; how many drives/relays are there, are they enabled/selected individually and how, how many yellow LED's there are and so on. Basically 'the sales pitch' and a brief 'user's manual'.
 

RoSi™

New Member
Actually to get RED LED from Relay is absolutelly great idea!

Thank You again.

At the present moment I will stick with the 4 HDD per chip, will be less pain that actually do more.
 
Top