Problem using INADC

jerry
Posts: 6
Joined: Thu Apr 18, 2013 12:47 pm

Problem using INADC

Unread post by jerry »

I am new to the EZSBC1 but have used basic on and off.
I want to read the Temp sensor on the Project board and when I enter:

pinmode 28, adc
x=inadc(28)
print x
end

When run, I get "Start program" , no error message, it just hangs. I have to use the EZSBC1 reset button to exit.
I have tried all of the things I could think of, what am I doing wrong?

Second problem, I can print text to a small serial printer connected to pin 36 using a one transistor inverter. Running:
x=serout(0,"some text")
end
But I can't figure out how to send a CR & LF. (is the x= necessary?) Thanks for any help, jerry
Daniel
Posts: 133
Joined: Tue Nov 13, 2012 2:10 pm

Re: Problem using INADC

Unread post by Daniel »

Hi Jerry

When I run the ADC code you sent it works so the syntax is correct. There is a small possibility that the program memory contains an invisible character before the start of the program that makes the program hang. To get rid of that possibility,
reset the module,
select the bank where the code doesn't work,
type D for download,
immediately type Ctrl-D to end the download.
This will effectively erase the program memory of that bank.

Occasionally I typed control codes while editing a program and that caused mysterious syntax errors because the control codes didn't print.

Also, try single stepping the code by pressing S instead of run and see if you get any more information.

Regarding the serial IO;
To make a string with CR and line feed appended do this

CRLF$=CHR$(0x0D)+CHR$(0x0A)
sout$="Some text"+CRLF$
x=serout(0, sout$)
end

will work.

Strings can be concatenated by using the + character. The first line build a string containing carriage return, line feed (in hex, old habit), the second line build a string with the end of line characters added and the third line sends it to the printer.

Serout returns an error code if things go wrong. I don't have the manual with me but it is there somewhere.

If thiis doesn't resolve you issues then please let me know.

Daniel
jerry
Posts: 6
Joined: Thu Apr 18, 2013 12:47 pm

Re: Problem using INADC

Unread post by jerry »

Daniel, thanks for the help.
Your CR-Lf solution works fine.

I am still having a problem with the inadc. I cleareand tried both memory banks and in single step it does not get past "x=inadc(28)" it just hangs. I also used 29's instead of 28's with the same results.

Also when the board arrived the "local power" jumper J1,was only on one of the terminals.I didn't notice it until I powered the board up. Per the boards picture I placed it across both terminals. What is the jumpers use?

Also the clock has never kept proper time even with a battery installed (+ up). I don't see any connection to the bottom, neg. end of the battery pad. The battery tests ok with a battery tester. Also when I measure the battery's voltage in the holder between power ground and the top + of the battery or holder, I only see about 0.1 volt.

Sorry for all of this, but maybe it's better than one at a time!
Thanks again, jerry
Daniel
Posts: 133
Joined: Tue Nov 13, 2012 2:10 pm

Re: Problem using INADC

Unread post by Daniel »

Hi Jerry

Your module is faulty. A new one is on its way.

The local power jumper is to choose which power supplies the EzSBC1, the USB or the 9V adapter through the regulators.
You should measure the battery voltage between the pin 39 and 40. The connector doesn't have a bottom section, it uses the PCB to make contact with the battery. Please make sure that the pcb below the battery holder is clean.

Daniel
jerry
Posts: 6
Joined: Thu Apr 18, 2013 12:47 pm

Re: Problem using INADC

Unread post by jerry »

Daniel,

Thanks for the quick reply.
I checked the clock battery between pins 39 & 40 and got only 0.1 volts.
I will add the power jumper usage to my manual.
Thanks for sending a new module, I will let you know how it works.

Things are looking up!

jerry
Post Reply