Exact match. Not showing close matches.
PICList
Thread
'[SX] Measuring Voltage'
2008\01\19@182627
by
djh82ukn/a
|
|
Hi Guys
Im trying to measure voltage using analogin on an SX48 protoboard.
Now I have the 2 10k resistors a 0.01uf cap (ceramic disc type) and have wired it as the example in the help file.
I have changed the pin to TLL as the max voltage I want to read on the test is 2v, now I am using the below code, and then runing debug and if I click run, stuff just goes red and the "a" variable in the watch list stays at 0.
Any ideas?
Here is the code:
' Example program using ANALOGIN command
DEVICE SX48, OSC4MHZ
FREQ 4_000_000
InPin PIN RA.0 INPUT TTL
OutPin PIN RA.1 OUTPUT a VAR Byte
voltage var byte
PROGRAM Start NOSTARTUP
Start:
voltage = a
ANALOGIN InPin, OutPin, a, 1
WATCH a
watch voltage
BREAK
GOTO Start
END
DJH (not part of code :P)
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
DJH,
Make sure you have everything connected correctly.
Do you get anything besides zero using CMOS on the input pin ?
Using TTL cause some side effect. Mainly that zero volts results in a positive value. And it requires a negative voltage being measured to get a zero result.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244374
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\20@115427 by djh82ukn/a
|
|
Still the same on cmos, sometines a=1 and sometimes a=0 but is random, sometimes a=189 on startup in debug mode.
double checked the coonnections, all seems ok, but RA1 does not seem to be putting out any voltage at all.
Im using a 9v supply to run the protoboard, and a regtualted psu to simulate voltage between 1-5V on cmos setting
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244488
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
DJH,
What is the voltage that you are trying measure coming from ?
What values to you get if you connect to ground and Vdd ?
Try different SX Pins and see if you get the same problem.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244605
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\21@110504 by djh82ukn/a
|
|
Hi bean, the voltage at the moment is coming from a regulated variable psu.
I will try other pins
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244664
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\21@110621 by djh82ukn/a
|
|
do I need the break command, as in is it needed for analogin to function?
or is it just part of that code?
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244665
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\21@110857 by djh82ukn/a
|
|
ok, stupid question, when it says ground, am I right in presuming that it means just the ground of the voltage to be measured, or should that also be connected to the ground on the protoboard.
Im beginning to think the latter, as otherwise when RA1 puts out voltage, it has no ground to work with so is useless
Please confirm, I feel really stupid now, this is what happens when i take a break from stuff for too long. :(
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244667
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
DJH,
Yes to need to connect the ground together.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244668
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\21@114338 by djh82ukn/a
|
|
thank you, tried another pin, same problem.
here is my code, led is red (else statement led1)
DEVICE SX48, OSC4MHZ
FREQ 4_000_000
InPin PIN RA.0 INPUT CMOS
OutPin PIN RA.1 OUTPUT
Led1 PIN RA.2 Output
Led2 PIN RA.3 Output
Led3 PIN RA.4 Output a VAR Byte
voltage var byte
PROGRAM Start NOSTARTUP
Start:
led2=0
voltage = a
ANALOGIN InPin, OutPin, a, 1
'WATCH a
'watch voltage
if a > 102 then
led3=1
else
led1=1
endif
'BREAK
GOTO Start
END just cannot figure it out
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244672
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\21@121501 by djh82ukn/a
|
|
Ok using debug, it seems the output pin works, when outputing I get 4.85V from it (voltage I am trying to test is only 3.7 atm), however it seems the input is not picking anything up at all, which would means I would get a 0 result?
If I put a multimetere prob at RA.0 it is always a ground, so how can it ever pick anything up?
I have RA.0 connect straight to inbetween the two resistors, which is also where one of the cap legs is connected (other cap leg goes to both grounds.
That sounds wrong but matches the diagram?
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244681
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\21@121754 by djh82ukn/a
|
|
Also the voltage is not getting past the first 10k resistor
I presume that the + symbols on the diagram do not mean anything other than to show the lines are connected, and not that possitive voltage should be connected to it?
Im more and more sure that this is a physical problem with my circuit, just cannot figure out where
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244683
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\21@152857 by PJ Allenn/a
|
|
djh82uk -- "I presume that the + symbols on the diagram do not mean anything other than to show the lines are connected."
???
pic attached
ANALOGIN (??)
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244742
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\22@045821 by djh82ukn/a
|
|
This is what i had to go from, sorry for any confusion http://forums.parallax.com/forums/attach.aspx?a=12087
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244854
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\22@160716 by PJ Allenn/a
|
|
The link is no good.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244984
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\22@162120 by djh82ukn/a
|
|
Works ok for me on another comp, I have taken a screenshot and attatched the picture, it's the same schematic as in the manual
Thanks
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m244990
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\22@182322 by PJ Allenn/a
|
|
Gosh, maybe this'll be an education for me, too.
I have SX/B 1.50 / SXKey v3.2 and I cannot find an ANALOGIN listed. Is that a part of a new Rev.?
"1.50" has an 8-Bit ADC (ADC8.SXB) in its Example Projects. The circuit is like yours, except that the input comes in on a third pin.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245018
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
PJ -- 1.51.03 dates to Sept. 2006 and is, in my experience, *extremely* stable. I wouldn't hesitate to install it. Another user found an error in SASM that prevents more than 10 includes, but that's unrelated to SX/B.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245131
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
The latest version 1.51.03, and all issues with it are documented here http://forums.parallax.com/forums/default.aspx?f=7&m=136824
Bean
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245138
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
The latest version 1.51.03, and all issues with it are documented here http://forums.parallax.com/forums/default.aspx?f=7&m=136824
Bean
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245139
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@074212 by PJ Allenn/a
|
|
OK, fine.
However, is the circuitry used to implement ANALOGIN the same as 1.50's Example Project (using 3 pins), or is it really just done with two pins?
If it is down to two pins, then perhaps my rendering (analogin.jpg) will shed some light on the subject (really don't like those ASCII-y things.)
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245154
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
PJ Allen,
The 8-bit ADC example in the help file uses the comparitor to compare the input voltage to the voltage generated from the PWM output.
The analogin is a different method. It does not use the comparitor, and can use any two pins.
It looks to me like both schematics you post are correct for the method being used.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245161
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@112212 by djh82ukn/a
|
|
Hi PJ
Yes that is how I have it connected, RA.0 going in between the 2 resistors, and also the one leg of the cap, my cap says it's a 104 or 103, and my resistors are 10k, but this is where I see a problem, 4.8V say through a 100k resistor, shows as 0v at the other end, so regardless whether the voltage is coming from the power source or from RA.1, RA.0 never sees above 0v it seems.
Any Ideas? Im sure it's something stupid on my part.
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245188
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
Why are you going through a 100K resistor ? That won't work. Just hook the 4.8 volts directly to the 10K resistor.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245194
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@115608 by djh82ukn/a
|
|
sorry they are 10k
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245200
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@120032 by PJ Allenn/a
|
|
[Quoting: "djh82uk"]A 104 is 0.1uF; a 103 is 0.01uF. So, which is it? It's supposed to be a 0.01uF (103.) That could be a problem, makes a difference.
my cap says it's a 104 or 103
If the circuit is disconnected from the SX pins you should measure the source voltage between the junction (R1, R2, C) and Ground or something is wrong (a bad contact in your breadboard, a bad cap.)
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245202
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@131052 by djh82ukn/a
|
|
Ok thanks guys will check when i can get back in the workshop
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245217
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@133838 by djh82ukn/a
|
|
right it is deffo a 103 cap (brown ceramic type), resistors were sold as 10k and multimeter also says they are 10k, (brown, orange, black, black, Brown) orange may be red.
with power disconnected to the sx, i get 5v before the resistor, and 0v after it.
Has got to be my problem would you agree?
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244365#m245227
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@134537 by djh82ukn/a
|
|
right, just tried it with a 2v Lead Acid battery and have the same problem, 0v at the end of the resistor, tried a new resistor same problem.
Would you actually get any voltage at the end tho? As a 470ohm resistor reduces 12v enough to run an led, so would'nt 10k completley wipe it out? or is it current related?
There is defiantley no voltage getting past that 10k resistor anyway
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245231
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@140107 by PJ Allenn/a
|
|
brown, orange, black, black, Brown = 1 , 3, 0, 0, x10 = 13K (If it's 'red' then the "3" is a "2"). Anyway, it's not 10K. If you are soldering to the ProtoBoard, then make sure it is to the "uncommitted" pads. ---------- End of Message ----------
The troubleshooting "experiment" requires that the circuit should be disconnected from the SX (note the Red Xs.)
Are you using a breadboard or are you soldering to the ProtoBoard?
If you simply solder these presumed resistors in series and place that across your voltage source, totally independent of the SX, does it "divide": 1/2 across one R and the same across the other?
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245240
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@143832 by djh82ukn/a
|
|
Hiya
Ha ha, did not think i mentioned that, but yes I have an ex-MOD multimeter with nixie tubes etc, has pressure relase valves and warm up circuit, very accurate, tho in this case I am using a normal digital multimeter, although I have a 5kv HT meter here too, tho never used it and prb never will (a good thing)
Right, i changed resitors, I found some that were 10k, (brown, black, red, gold) and also showed as 9.98k on multimeter,
Wired them as the diagrame (the one with the red x's) on a breadboard completley away from the sx, gave it 5v, and I get 5, 4.8v and 4.9v at the 3 possible test points on the resistors, so I then used these resistors on the sx board to replace the others, the sx is giving out 5v at the pin into one end of the resistors in series, and im giving it 5v at the other end, shows as 0v in the middle tho, and so RA.0 is also getting 0v, hence the lack of a reading. Perhaps i should describe the circuit, fresh eyes and all that.
RA.1 is connected to a resistor, connected to the other end of that is another resistor, on the end of that is the possitive connection of the voltage i wish to measure.
RA.0 is connected to the junction between the 2 resistors, , as is one leg of the cap, the other end of the cap is connected to the ground of the voltage I was to measure, as well as the ground of the sx protoboard (VSS).
I am soldering to the protoboard and not using any pads that are connected to anything else.
Thanks for your patience, sorry if I sound stupid, I am useless with electronics theory, something I really need to brush up on when I have time. Yet I can troubleshoot problems on games consoles, psu's etc, down to component level, im self taught which is prob not a good thing.
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245259
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@143953 by djh82ukn/a
|
|
OK, if I put the multimeter leads on as follows, possitve lead to VDD, and neg lead to RA.0, I get a 5v reading, so ra.0 is effectively ground.
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245260
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@145916 by PJ Allenn/a
|
|
brown, black, red, gold is a 1kohm, 5% tol. (1, 0, and 2 0's.) Is it reading "0.998"? I think that "we" need to get these values nailed. You need to get some 10K resistors, brown-black-orange, or bust.
I'm thinking about installing the 1.51 SX-Key/SXB to find out what's what here. But at this rate I've > 1/2-a-mind to just whump up a board for you to plug into.
If anybody wants to jump in, it's OK by me.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245268
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
PJ,
You can look at either the CHM or the PDF of the help file for the ANALOGIN documentation from this thread:
http://forums.parallax.com/forums/default.aspx?f=7&m=136824
Bean
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245276
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@161642 by djh82ukn/a
|
|
Ok, im fairly sure it's 10k, the red could well be orange, it was ordered from rapid electronics and says 10k on the bag, and is deffo 9.98 on the multimeter, looking at the resistors there is very little difference between red and orange, or im colour blind :P
Sorry for the confusion
Thing is, if the one end of the resistor is positive, then surely the end (middle of the two) that connects to RA.0 is always going to be negative as it currently is.
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245284
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@162015 by djh82ukn/a
|
|
Thanks for all your help btw, it's very much appreciated
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245286
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@162243 by PJ Allenn/a
|
|
OK, thanks, Bean.
There we read:
The PROGRAM directive sets the execution start point (at a label.)
When the NOSTARTUP option is used the SXB compiler will NOT insert the normal start-up code that pre-initializes all RAM addrs to zero; in this case the programmer is responsible for appropriate initialization...
Note that when the NOSTARTUP option is used the TRIS registers are NOT initialized, so you MUST set up the ports as INPUTs or OUTPUTs.
djh82uk's program has the NOSTARTUP option.
So, even though somebody uses:
InPin PIN RA.0 INPUT CMOS
OutPin PIN RA.1 OUTPUT
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245288
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@175758 by djh82ukn/a
|
|
but if I always get 0v at the ra.0 pin, does that not point to a problem with the circuit itself? just trying to understand
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245298
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\23@185020 by PJ Allenn/a
|
|
It isn't clear to me that RA.0 is made an INPUT and/or RA.1 is made an OUTPUT if they get declared as such before the PROGRAM directive (or if that matters, but I think it must.)
Will this Compile and Run --
DEVICE SX48, OSC4MHZ
FREQ 4_000_000
PROGRAM Start
Start:
'TRIS_A = %00000001
a VAR Byte
InPin PIN RA.0 INPUT CMOS
OutPin PIN RA.1 OUTPUT
Led1 PIN RA.2 OUTPUT 'Result Indicator
Led2 PIN RA.3 OUTPUT 'Acquisition annunciator
Testing:
Led1 = 0
Led2 = 0
ANALOGIN InPin, OutPin, a, 1
IF a > 150 THEN LED1 = 1 'Threshold appx 2.9V
Led2 = 1 'indicates acquisition
PAUSE 2000
GOTO Testing
2008\01\23@190555 by djh82ukn/a
|
|
I will give it a go tommorrow as it's 3am atm, I think RA.1 is deffo working as an output as it appears so in debug, and gives out 5V when it says it is, but I see what you mean by the input.
I will give your code a try
Thanks :)
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245323
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\24@055917 by djh82ukn/a
|
|
ok, code would not work without an endif statement,
however it seems that it ignores the input/output directives if under the "start:" as the led does not work, put them above the start and the led shows red, but still not getting any voltage.
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245411
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\24@162138 by PJ Allenn/a
|
|
OK.
Well, I copied over the 1.51.03 stuff (but now I don't have Help anymore, except the PDF, the .chm doesn't work.)
I re-wrote, a bit, the previous, and this Compiles:
DEVICE sx28, oschs3, TURBO, STACKX, OPTIONX
IRC_CAL IRC_SLOW
FREQ 10_000_000
PROGRAM Start
a VAR Byte
start:
TRIS_A = %00000001
'RA.0 analogin's input
'RA.1 analogin's output
'RA.2 Result Indicator
'RA.3 Acquisition annunciator
Inpin PIN RA.0 INPUT CMOS
Testing:
RA.2 = 0
RA.3 = 0
ANALOGIN Inpin, RA.1, a, 2
IF a > 150 THEN Good 'Threshold appx 2.9V
RA.3 = 1 'indicates acquisition
PAUSE 2000
GOTO Testing
Good:
RA.2 = 1
RETURN
No ENDIF needed.
I guess the THEN can't be to a "RA.x = _" like I had, so I made a "Good" subroutine to turn the "> 150" LED on with.I don't have any SX48s, only SX28s.
So, it'll be a bit till I can get the circuit together and all, but that's what I'll be doing.
2008\01\24@170439 by djh82ukn/a
|
|
Thanks PJ, driving me nuts, I still don't understand how it's going to work by the diagram, I just don't see how ra.0 can ever sense a possitive voltage.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245584
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\25@182259 by djh82ukn/a
|
|
Above code does not work either, same problem in that RA.0 is just not getting to se any voltage, i still think it may be a circuit problem, but as I said, i cannot see how it can ever be anything other than ground
Thanks for all your help btw, I do really appreciate it
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245865
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\26@104357 by PJ Allenn/a
|
|
OK -- It works:
DEVICE sx28, oschs3, TURBO, STACKX, OPTIONX
IRC_CAL IRC_SLOW
FREQ 10_000_000
PROGRAM Start
a VAR Byte
blink VAR Byte
start:
TRIS_A = %00000001
'RA.0 analogin's input
'RA.1 analogin's output
'RA.2 Result Indicator YEL
'RA.3 Acquisition annunciator GRN
LVL_A = %00000001
Testing:
a = 0
RA.2 = 0
RA.3 = 0
ANALOGIN RA.0, RA.1, a, 1
IF a > 150 THEN Good 'Threshold appx 2.9V ?
Back:
RA.3 = 1 'indicates acquisition
PAUSE 2000
FOR Blink = 0 TO 9 'Blink ACQ before re-testing
RA.3 = 0
PAUSE 100
RA.3 = 1
PAUSE 100
NEXT Blink
GOTO Testing
Good:
RA.2 = 1
GOTO Back
Looks like I cannot IF...THEN...GOSUB (?), so I made the "Back" subroutine.
The threshold looks to be approx. 1.2V. I think that's because with my 10MHz clock I should probably have used a smaller value CAP. The "manual" states that the optimal value will be found with experimentation (so, experiment.)
I made a video, but youtube is slag cow today. If I can get it U/L'd later (>15 min. and it never finalized) I'll P-M you and post here same.
I've broken practically every "style" rule, but it's documented well, in my opinion, and it's so short that one should be able to follow along anyway.
If you leave the input floating then the result LED will be unreliable.
2008\01\26@160459 by djh82ukn/a
|
|
ok, Still no luck this end
I had to change the pins for the led as im using a tri-colour led, so just swapped ra.3 for ra.4 and set ra.3 to always be 0 took out the reference to the chip type and crystal, then used the device dialog box to set the chip to sx48 and crystal to internal 4MHz, problem is nothing happens, no leds or anything, and no voltage to the led pins, if I run it in debug nothing happens there either, it just sits at _progstart.
I really appreciate all you have done PJ, I feel like im letting things down from my end, it's been ages since ive touched an SX which just isn;t helping, ive been over the circuit a hundred times, im wondering if there is something I should be doing different due to the fact it's an SX48?
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246016
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\26@162035 by djh82ukn/a
|
|
OK, may be getting somweher, PIN RA.4 just will not work, won't put out any voltage is it a Special/dual function pin on the sx48? trying to find the datasheet now
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246020
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\26@162457 by djh82ukn/a
|
|
HA HA HA
Im so stupid, there isn't an RA.4, it's labelled on the board, has tracks going to it etc, but I presume it was for the SX52 or something, datasheet just confirmed, I would have thought it was RE that had only 4 pins and not RA, oh well, time to re-solder.
let you know how it goes
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246021
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\26@164438 by PJ Allenn/a
|
|
With regard to the program as I wrote it, RA.3 should always be blinking or solid on (except during the very brief time that ANALOGIN is doing its thing.) That's your gut-check right there.
Are you sure you have the LED polarities right?
Upload your program so that we can all have at you.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246024
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\26@174342 by djh82ukn/a
|
|
Hmm, led probs fixed, but still not getting any reading at RA.0, checked the circuit again, and it is the same as yours, ra.0 gets -4.8v constantly
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246028
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
Ok, Finally all working :)
All thanks to PJ Allen of course, basically the problem was that it just would not work with RA.0, changed it to RC.0 and it worked with the code that PJ had written for it. I did try a different pin earlier on in this quest, but I think it still did not work due to the code not being right, but once PJ had a go at it it all got sorted :)
The readings are a little funny, but consistent, I am using it in a cold shed, cheapo capacitors and the internal crystal at 4MHz, but it's doing it's jon and im happy.
Thanks a lot PJ and anyone else that added input :)
Reminds me why i should stick to parallax micro's, for the forum support as I definatley need it
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246044
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\27@084155 by djh82ukn/a
|
|
Ok new question,
can the SX48 check voltage with analogin on different pins one after the other? Or can it only be used on one pin per program?
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246116
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\27@084827 by PJ Allenn/a
|
|
I suspect you could have as many as you need, so long as each pair has its own ANALOGIN circuit.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246117
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\01\28@095428 by djh82ukn/a
|
|
HMM, ive got it testing 2 voltages and it works, but if I drop the coltage on the RB test it's fine, re-apply power and it goes back to testing, but if I drop the voltage on the RC test then it does not update the value and stays in the lower voltage mode, although the relay does click on and off.
Any ideas?
DEVICE SX48, OSC4MHZ
FREQ 4_000_000
PROGRAM Start 'NOSTARTUP a VAR Byte
b VAR Byte
blink VAR Byte
start:
TRIS_A = %00000000
TRIS_B = %00000001
TRIS_C = %00000001
'RC.0 analogin's input
'RC.1 analogin's output
'RA.2 Result Indicator YEL
'RA.3 Acquisition annunciator GRN
LVL_C = %00000001
LVL_C = %00000001
Testing:
'a = 0
RA.1 = 0
RA.2 = 0
RA.3 = 0
RB.3 = 0
RB.4 = 0
ANALOGIN RC.0, RC.1, a, 2
'pause 1000
ANALOGIN RB.5, RB.6, b, 2
watch a
watch b
IF a < 190 THEN Charge1
IF b < 190 THEN Charge2 'Threshold appx 2.9V ?
Back:
RA.1 = 0
RA.3 = 1
RB.3 = 1 'indicates acquisition
PAUSE 2000
FOR Blink = 0 TO 9 'Blink ACQ before re-testing
RA.3 = 0
RB.3 = 0
PAUSE 100
RA.3 = 1
RB.3 = 1
PAUSE 100
NEXT Blink
GOTO Testing
Charge1:
RA.2 = 1
RA.1 = 1
RB.3 = 1
pause 5000
IF b < 190 THEN Charge2
GOTO Testing
Charge2:
RA.3 = 1
RB.4 = 1
Pause 5000
GOTO Testing
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246340
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
|
|
STill struggling with this, just cannot get it to retest RC.0, first test works fine, seconds just does not happen, while RB.5 wil test and retest ok.
the code is very similar between charge 1 and charge2, but even if I make them identical it still does not work
Any ideas?
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=3&m=244365#m249164
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
2008\02\15@094451 by djh82ukn/a
|
|
Ok the problem was that is needed a Pause after the command to turn the relay off, thanks to PJ Allen for figuring this out :)
DJH
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=3&m=244365#m250278
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2008
, 2009 only
- Today
- New search...