Pwmout

AKil

Member
Hello i have a 2 dudes

1. I have a senoidal onde , the commando Readadc can read that signal? or what it give me?

2. How i know if my picaxe is not a blank micro.
 

BeanieBots

Moderator
1. I don't know what a "senoidal onde" is but I'm guessing you mean a Sine Wave?
The ReadADC command takes an intant measurement.
So, the reading you get will be a function of whatever voltage is on the pin at the instant the command executes.

2. How i know if my picaxe is not a blank micro.

It'll be whatever you bought!
When it arrived, you put a label on it before you put in the micro drawer didn't you? Read the label!

If your label accidentally fell off, don't worry.
Use the 'firmware command'. It will tell you which PICAXE it is.
If it's not a PICAXE (or your download circuit is faulty) you will get
"Error hardware not found on Com #".
 

BeanieBots

Moderator
ADC can only read a voltage between Vcc (nom. 5v) and 0v.
Negative is only relative. Simply add a DC offset or use a couple of resistors to offset the ADC input.

What will it read for a sinewave.
As described above, whatever voltage the sine-wave is at in the instant it takes the reading. Could be absolutely any value. Impossible to say.

Rectify the signal into a DC level between 5v and 0v. Then measure that.
Do you want RMS, mean or peak voltage reading for your sine-wave?
 

AKil

Member
main:
readadc 4,b1
if b1 > 100 then
high 1
end if
if b1 < 100 then
low 1
end if
goto main
but the led make high and low all time i put a DC voltage to pin 4 and i alterne 0 to 5v but nothing.
 

AKil

Member
main:
pause 2000
pwmout 2,25,53
wait 1
readadc 4,b1
if b1 < 200 then
high 1
end if
low 1
goto main
the other program is ok now but theme it make only the pwmout and dont read adc :S and other theme when i connect normal supllie not a FA the pwmout only give 2 vpp :S
 

hippy

Ex-Staff (retired)
I do not really follow what you are saying but your code works fine when I tested it after a modification in the HIGH 1 / LOW 1 handling ...

Code:
#picaxe 08m
main:
  pause 2000
  pwmout 2,25,53
  wait 1
  readadc 4,b1
  if b1 < 200 then
    high 1
  else
    low 1
  end if
  goto main
It may be worthwhile posting a circuit diagram of what you have. How are you measuring PWM out and where from ?
 

AKil

Member
This is my circuit


The Pwmout are diferrent when i put a pile AAA is see only 1 Vpp on oscilo. and when i put FA i see 2 vpp or 3vpp
 

Attachments

BeanieBots

Moderator
That diagram is not much help really.
We need ALL the information.
Please give pin numbers and include your serin pin connections.
Show EVERYTHING which is connected to the PICAXE.

Where are you putting a AAA? (I assume this a 1.5v battery)
What is a FA?
 

AKil

Member
yes AAA is 1.5v the pin u can see in the programa , when i put AAA the Pwmout down to 1 vpp and when i put power source 2,5vpp always i supply 5 v


Picaxe 08M , the program is in the page 5
 

BeanieBots

Moderator
I apreciate that english is not your natural language but I do not understand what you are saying.

Please draw the diagram FULLY labelled and show where you are putting these voltages.
Without this information I (or anyone else) cannot help you.
 

AKil

Member
I tried the circuit with a power supply, a PICAXE 08M programmed with pwmout and a readadc.

When I tried this circuit it only do the pwmout and the readadc did not function. Although when I did not execute pwmout
readadc read all I have in pin 4. It is posible that the both can not go together? or picaxe08M did not do...

When I try with a pile also not read the 2 at the same time, only reads pwmout but it does not give me 2,5 Vpp like
the power supply. It gives me 1,5 Vpp. Why the amplitude vary with 4 piles AAA of 1,5V (6V in total).
 

hippy

Ex-Staff (retired)
Sounds like you may have a wiring fault. I tried your code and it worked, PWMOUT and READADC, as reported in Post #50.
 

AKil

Member
U have tryed the 2 command in the same command i tried and make pwmout but after i readace its ok but in i put 0v in pin4 and always is low :S
 

AKil

Member
When i tried work the 2 command , first i create the pwmout and after that i readadc but when i make pwmout the chip dont readadc. But if i put only readadc this read.
 

AKil

Member
The code in #50 somthimes he the chip don't make the 2 sentences, ( pwmout + readadc)only make pwmout...
 

hippy

Ex-Staff (retired)
The code in post #50 works. Both PWMOUT and READADC can be used in the same program.

That you are not getting rail-to-rail voltage switching on a digital output indicates to me that -

* You are reading the voltages incorrectly
* There is a wiring fault with the circuit
* The circuit is not as previously described
* The PICAXE has been damaged

Please post your latest source code, a complete circuit diagram, and preferably a photograph of your assembled circuit.

Also, how do you know that the PICAXE is not executing READADC ?

Do you have another PICAXE-08M, does that behave the same way ?

Try executing this code -

#Picaxe 08M
Do
Toggle 2
Pause 1000
Loop

Does the PWMOUT signal on leg 5 switch between 0V and +V every second ?
 

hippy

Ex-Staff (retired)
All the information you should need is in the CHI030.PDF datasheet. That should be accessible via Programming Editor Help and is also available from that page via "Click here for datasheet".
 

MartinM57

Moderator
The datasheet that you can download from that web page (also at http://www.rev-ed.co.uk/docs/CHI030.pdf) seems to explain how to supply 0V and +V to it very well.

..but it is not quite so clear about downloading into the PICAXE, although the information is there - the trick is understanding that CT1 on the schematic on page 7 is the old-fashioned Molex programming connector:
- connect your PC transmit to the centre pin of CT1
- connect your PC ground to the bottom pin of CT1
- connect your PC receive line to the top pin of CT1.
 
Top