J
Jan Panteltje
Guest
I have added the 0.1 version asm source code, released under the GPL:
ftp://panteltje.com/pub/gm_pic/gm_0.1.ASM
This code was assembled with gpasm-0.13.7 beta
and I would not be a bit surprized if it did not assemble on MPlab.
Some comments on the code:
I added micro Sievert display on line 2 of the LCD,
this is derived from the counts per minute on line 1 by simply dividing by 100.
That division factor is different for each type of GM tube, it is a #define at the top of the source file.
Measurement is once per minute, and this means you have to wait one minute for the first displayed value.
If you have a more sensitive tube modify the code.
There is some interesting info on radiation exposure at the to of the asm file too.
I want to point out again, considering diagrams and code, that this is a design group, and if you are too stupid
to get the gist from the sketches, or need hand holding to write code,
try sci.electronics.basics, or oder a kit from somewhere, and complain to your mama.
This is just about solutions and ideas.
Things constantly change anyways, both in the hardware and the software.
As far as connectivity goes, this thing communicates with the PC at 19200 Bd, 1 start bit 8 data bits, 1 stop bit, no parity, if you are lucky.
That last thing because it assumes your RS232 takes 0V for 0, and does not need at least -3V.
If that sucks use a MAX232, or one of the many other solutions.
You can type 'h' for a menu:
grml: ~ # ptlrc -d /dev/ttyUSB0 -b 19200
Panteltje ptlrc-0.6 using device /dev/ttyUSB0
Escape exits.
RS232 commands:
B LCD backlight on, saved in EEPROM.
b LCD backlight off, saved in EEPROM.
C flash clock separator, status saved in EEPROM.
c do not flash clock separator, status saved in EEPROM.
D enters debug mode, continuously prints ADC steps for U GM tube, U battery, and flags2.
d exits debug mode.
F sets PWM frequency in kHz, range 19 kHz to 154 kHz, default 39 kHz, saved in EEPROM.
GnnnENTER sets clock calibration, timer1 reload low byte, use 175 for nominal, is saved in EEPROM.
at first power up (directly after programming) the EEPROM is set with the default value for G(175).
HnnENTER sets hour, range 0-24.
h prints help.
MnnENTER sets minute, range 0-59.
PnnnENTER sets maximum PWM value, range 0 to 100, stored in EEPROM.
S sets soft start speed, range 1-15.
s prints status: time, local/remote voltage control, max. pwm, pwm, battery voltage, GM tube voltage.
UnnnENTER selects output voltage, range 0-31, stored in EEPROM.
v prints version number.
As the attentive reader can see, you can set and get almost any parameter via RS232,
you can set the GM tube voltage, the soft start, the max PWM width, the clock, look at the ADC values,
look at the battery voltage, even control the LCD backlight.
In this (new) diagram the LCD backlight is driven from a PIC pin and draws about 7 to 8 mA when on,
just enough light to clearly see it in absolute dark, in even a slight nucleus [!G.W.Bush] sunshine you will need no backlight,
possibly never again.
Option F for PWM frequency depends on the kind of transformer you will wind (you will have to know how to do that) or use.
You will have to set, without GM tube connected, the GM voltage to about 600 V with max PWM command P, and then set the voltage to normal
with U7ENTER, that should show about 475 V.
Do not play with U8ENTER or higher wit ha GM tube connected, this thing will go way above 500V.
Here is my status display, all values are saved in EEPROM, at least in this value of the soft,
and it should start up correctly with MY transformer, but not yours:
grml: # ptlrc -d /dev/ttyUSB0 -b 19200
Panteltje ptlrc-0.6 using device /dev/ttyUSB0
Escape exits.
Clock cal 175
0:27
PWM frequency 19 kHz
PR2 reload 101
Softstart speed 10
Remote voltage control
Uout select 7
PWMmax. 30
PWM 30
Ubat 10.2 V
UGM 475 V
PS the battery shows 10.2 it is the maximum the display will go to, as normally it expects a 9V battery,
but I am stuffing 12V DC into it to save buying or charging batteries.
ftp://panteltje.com/pub/gm_pic/gm_0.1.ASM
This code was assembled with gpasm-0.13.7 beta
and I would not be a bit surprized if it did not assemble on MPlab.
Some comments on the code:
I added micro Sievert display on line 2 of the LCD,
this is derived from the counts per minute on line 1 by simply dividing by 100.
That division factor is different for each type of GM tube, it is a #define at the top of the source file.
Measurement is once per minute, and this means you have to wait one minute for the first displayed value.
If you have a more sensitive tube modify the code.
There is some interesting info on radiation exposure at the to of the asm file too.
I want to point out again, considering diagrams and code, that this is a design group, and if you are too stupid
to get the gist from the sketches, or need hand holding to write code,
try sci.electronics.basics, or oder a kit from somewhere, and complain to your mama.
This is just about solutions and ideas.
Things constantly change anyways, both in the hardware and the software.
As far as connectivity goes, this thing communicates with the PC at 19200 Bd, 1 start bit 8 data bits, 1 stop bit, no parity, if you are lucky.
That last thing because it assumes your RS232 takes 0V for 0, and does not need at least -3V.
If that sucks use a MAX232, or one of the many other solutions.
You can type 'h' for a menu:
grml: ~ # ptlrc -d /dev/ttyUSB0 -b 19200
Panteltje ptlrc-0.6 using device /dev/ttyUSB0
Escape exits.
RS232 commands:
B LCD backlight on, saved in EEPROM.
b LCD backlight off, saved in EEPROM.
C flash clock separator, status saved in EEPROM.
c do not flash clock separator, status saved in EEPROM.
D enters debug mode, continuously prints ADC steps for U GM tube, U battery, and flags2.
d exits debug mode.
F sets PWM frequency in kHz, range 19 kHz to 154 kHz, default 39 kHz, saved in EEPROM.
GnnnENTER sets clock calibration, timer1 reload low byte, use 175 for nominal, is saved in EEPROM.
at first power up (directly after programming) the EEPROM is set with the default value for G(175).
HnnENTER sets hour, range 0-24.
h prints help.
MnnENTER sets minute, range 0-59.
PnnnENTER sets maximum PWM value, range 0 to 100, stored in EEPROM.
S sets soft start speed, range 1-15.
s prints status: time, local/remote voltage control, max. pwm, pwm, battery voltage, GM tube voltage.
UnnnENTER selects output voltage, range 0-31, stored in EEPROM.
v prints version number.
As the attentive reader can see, you can set and get almost any parameter via RS232,
you can set the GM tube voltage, the soft start, the max PWM width, the clock, look at the ADC values,
look at the battery voltage, even control the LCD backlight.
In this (new) diagram the LCD backlight is driven from a PIC pin and draws about 7 to 8 mA when on,
just enough light to clearly see it in absolute dark, in even a slight nucleus [!G.W.Bush] sunshine you will need no backlight,
possibly never again.
Option F for PWM frequency depends on the kind of transformer you will wind (you will have to know how to do that) or use.
You will have to set, without GM tube connected, the GM voltage to about 600 V with max PWM command P, and then set the voltage to normal
with U7ENTER, that should show about 475 V.
Do not play with U8ENTER or higher wit ha GM tube connected, this thing will go way above 500V.
Here is my status display, all values are saved in EEPROM, at least in this value of the soft,
and it should start up correctly with MY transformer, but not yours:
grml: # ptlrc -d /dev/ttyUSB0 -b 19200
Panteltje ptlrc-0.6 using device /dev/ttyUSB0
Escape exits.
Clock cal 175
0:27
PWM frequency 19 kHz
PR2 reload 101
Softstart speed 10
Remote voltage control
Uout select 7
PWMmax. 30
PWM 30
Ubat 10.2 V
UGM 475 V
PS the battery shows 10.2 it is the maximum the display will go to, as normally it expects a 9V battery,
but I am stuffing 12V DC into it to save buying or charging batteries.