PDA

View Full Version : Radon Sensor



Travin77
- 6th April 2006, 03:15
Hello all again. One of these days I will be able to provide some useful info to the forum. As for now I am just absorbing everyones knowledge. I was wondering if anyone would mind taking a look to see what I am doing wrong. I am trying to interface to a serial radon sensor. Here is what the datasheet says to do:

Protocol
The radon protocol uses a standard ASCII charter set. The radon device
acts as a slave and will not respond with out a request from a host
computer. All commands and data request to the detector are defined as
“cxx” where xx is a specified command. Sending a command will always
result in an acknowledgement or data response.
All responses from the detector start with a “dxx..” where xx is the
specified command requested followed by data dd. After all data is sent
the packet will be follow with a carriage return and a line feed. The
following are the definition of the commands or data requests.

The command I am trying to send is c01 which is a little farther down the datasheet. Here is my code. I tried using serout2 but it didn't work. So I decided to use the debug and debugin commands but I can't get a response from the sensor.

include "MODEDEFS.BAS"
define LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_BITS 4
DEFINE LCD_RSREG PORTC
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 1
DEFINE LCD_lines 4
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
define OSC 20
define debug_reg portc
define debug_bit 7
define debug_baud 9600
define debug_mode 0
define debug_pacing 1000
define debugin_reg portc
define debugin_bit 6
define debugin_mode 0
radon var byte [10]

Pause 1000
lcdout $fe,1
Start:
lcdout $fe,$c0,"screen test"
debug "c01"
debugin [skip 3, str radon\10]
lcdout $fe,$80,str radon\10
Pause 1000

goto start

I am using a 16f876a with PBP and 20mhz resonator. At first I tried not using a max232 chip and using the inverted mode as per the PBP manual but it didn't work. So I purchased a NTE7142 serial 232 chip and it still doesn't work. Maybe one of you could explain to this dummy what I am doing wrong. Once again, thanks for all the help.

Travin

sougata
- 6th April 2006, 08:14
Hi,

Have you tried the sensors with Hyperterminal or the MCS Serial Communicator? This would at least prove that the sensor works as intended.

Travin77
- 7th April 2006, 02:59
I can get data by polling the sensor using co1 and then transmitting. Am I sending the correct data on my code?