How about it? Experiments of the third kind , take 999999. Update Source code and diagram sketches
Things are moving on, and I wrote the main board software in asm. All it does is test if some voltages are in range, and processes error messages from the PIC micro controller in the little black box, and sounds an alarm if something is not right. You can also via the terminal talk to BOTH PICs, each has there own command set, and will show you status, ADC steps, voltages, last error message, and there is a wide choice of test and debug commands [1]. If an error occurs a beeper sounds with different beeps for each error, you can then connect a terminal and it will then display what the problem was, in the best case i twas 'ready, one year data acquired'.
Here is the PIC 18F14K22 source code for the little black box with the tritium light:
And here is the source code for the PIC 18F14K22 in the main board that handles the alarms:
This is not the final code, I still have some issue with false alarm I need to look into.
Here is the black box circuit diagram sketch:
Here is the circuit diagram sketch of the main board:
I know nobody can read those ;-), and some even have holes in them, but I can.
I though the asm sources would be nice for people like J. Larkin to read in bed in the evening as debug puzzle, maybe he will find that false alarm issue.
[1] There is a command to dump the acquired data, it is protected with a PIN code, as now it takes very long and would disturb the clock tick. So this command can only be executed when data is complete. But if you want to mess up things you can use command 'r' and keep the 'r' key pressed, and it will basically step through all the acquired data. The safe way is to use command 'R' to inspect a data point at any time.Here is a 'session', I typed 'h' for help from the black box processor, then I typed 's' for status from the black box.
Then ctrl H for help from the main board processor. and then I typed ctrl S for status from the main board.
Alarm silence switch was activated, waiting for timeout!, seconds left: 2 Alarm silence switch was activated, waiting for timeout!, seconds left: 1 Alarm active
Panteltje (c) tritium decay experiment-0.1 RS232 commands 115200 Bd 1 start bit, 8 data bits, 1 stop bit: C debug mode on, reads and prints ADC values and current PWM value continuously. c debug mode off. DnnnnENTER set day. E dump acquired data. GnnnENTER set clock calibration, set timer1 reload, default 219, saved in EEPROM. HnnENTER set hour. h help, this help. InnENTER set seconds between PWM increase or decrease by temperature controller, 1/igain, default 1, saved in EEPROM. MnnENTER set minute. PnnnENTER set PWM pulse width start value, saved in EEPROM RnnnnENTER display data entry nnnn (0 to 10922). r display next data entry, from value set by R. s status, print PWM, clock calibration (timer1_reload), time, temperature setpoint, igain. TnnnnENTER set temperature setpoint, saved in EEPROM. Y65535ENTER restart acquisition at zero, resets clock and data pointers to zero, data in external EEPROM is left untouched until one hour passes. PWM 74 clock calbration 219 on time 0 days 0:1-23 data pointer 0 temperature setpoint 490 igain 1
Panteltje (c) tritium decay experiment-0.1 RS232 commands 115200 Bd 1 start bit, 8 data bits, 1 stop bit: main board processor menu ctrl X debug mode on, reads and prints ADC values continuously. ctrl A debug mode off. ctrl H help, this help. ctrl S status, prints external voltage, battery voltage, PIC supply voltage, battery present {B) or not (_), silence_switch state, silence(S) or normal(N), latest tri_pic alarm code. The following code sequences will trigger an alarm beep (lower case control is OK): ctrl G A acquisition complete alarm. ctrl G B brownout alarm. ctrl G D data verify error alarm. ctrl G E PIC internal EEPROM verify error alarm. ctrl G F framing error. ctrl G I no iic ack alarm. ctrl G T temperature out of range alarm. ctrl G W watchdog alarm. Normally these codes are send by the PIC in the tritium light box if an error occurs, it is however possible to enter these codes at the terminal for test purposes. Uexternal 12.2 V Ubat 4.7 V UPIC 3.4 V Latest tri_pic alarm was: none
Some remark about the hardware: The RS232 out is logic level ORed for both PICs, so both can talk to you. The RS232 in goes to black box PIC, and the main board PIC sees both the terminal RS232 and the black box PIC RS232 also via an OR. The OR gates are realized with 1n4148 diodes, not because Jim claimed nobody uses diode ORs... I heard that :-) and I use them a lot.
Anyways, that makes writing software very tricky, as theoretically, and most certainly also in practice, things can go in a loop. Because of that you will find funny escape sequences in the source that use BELL signal as escape signal for error message codes, and a BELL followed by a CRLF sequence as 'no action code'. Just when you read that code in bed late at night [do not start] dreaming about it...
So, a lot more testing is needed, anything can still change, but basically the unit is complete. I expect very few hardware changes.