serial hanging problem, alternatives?

MrScaussie

New Member
Long time lurker here, (and relative novice) usually I try to solve most problems by reading and re-reading posts etc, this one has me stumped.
I'm using the AXE110 datalogger together with an 08M to log various pieces of information.
I have 4 switches, A,B,C & D connected to the 08M. The 08M sits about 10 metres away from the AXE110, the wiring has already been installed and wouldn't be easy to modify.
I had written some code to output the status of the 08M serially to the logger.
I tested the various bits of code along the way and everything worked ok separately, but when it was all put together it didn't work.
After then reading about the serial hanging problem did I realised why.
So I'm looking for another solution to convey the status of the 4 switches to the logger without interrupting the logger, ie the logger simply 'looks' for a status on one of the input pins from the 08M, and either logs it or ignores it and continues on doing the other tasks required.

The switches are connected to the 08M in the following manner either A or B or C can be connected (on) at any time never more than one, switch D however can be 'on' regardless of the state of the others. The code I have already written simply outputs a letter for each of the switches A,B or C and X in the case of all three switches in the off position. I output a second letter for switch D, being either D or X again X means off.
So the serial information being passed to the logger is in the form of AD, XD, AX etc I then simply log the letters and I 'know' the status of the switches at any given time.
Since the serial in hanging problem I have tried to find an alternative solution to output the switch status to the logger. I thought today after reading many posts that using PWM (to create an analogue value) and reading the ADC value into the logger in that way might work, ie 0v(ADC value 0) represents all switches off and say 4 volts (ADC value 255) represents say switch C & D on, and the various levels in between can represent the other conditions. It wouldn't have to be too accurate ie anywhere between 130 to 140 could represent switch B on and switch D off.
There are only four states that the first three switches can be in each (separately) on or all off, and only two states that switch D can be in either on or off.
Is this an overly complicated way of going about things?

I should have tested the whole system before installing the wiring, but I thought I would be ok as I tested each part of my 'system' as I went along.
I don't have enough I/O's on either the 08M or the logger to have a separate I/O for each switch (even if I had enough spare wires) anyway.

Sorry for the long winded explanation just wanted to give a better idea of how I have got to where I am.
There was probably a much more efficient way to build it but i thought it would be a good way to learn about various aspects of each chip.
 

hippy

Ex-Staff (retired)
I think the real issue is what particular "Serial hanging problem" this is, and how it affects what you are doing on the datalogger side of things - What's the datalogger doing such that serial hangs are a problem ?

You seem to have 8 states ( none, A, B, C, D, A+D, B+D, C+D ) and that should be possible to accurately convey using PULSOUT, PWMOUT or by analogue driven with PWMOUT. Viable solutions will depend on how you have your 08M hardware wired; if needing four inputs for your switches, that only leaves Pin 0 for output so you are limited to SEROUT/SERTXD or PULSOUT.
 
Last edited:
Top