Why is portc high = low?
Using Picaxe "portc", I can get 16 outputs from a picaxe 28, which is neat.
But I allways wondered why you have to write "high portc 5" to get "portc 5" to be "low"??
I understand that since it on default is an input-port, it must be set on "high" on power up. But still you should set it to "low" by writing "low portc 5", and not "high portc 5"?
Gets quite confusing sometimes in my code; half of the outs has to be set low to be high!?!?!



@ Thu, 2009-12-10 19:51
The new guy wants to try an old problem...
(I got my picaxe 28x1 starter pack about two weeks ago, so I am no expert... yet!)
I have had the same problem as Fritsl and wanted it to work as the manual stated it should work.
(I assume Fritsl is doing this.)
When you connect a led to digital input 1 and V1+
and write:
main:
high portc 1
wait 4
low portc 1
wait 1
goto main
The led will be "low" for four seconds and high for 1.
Jka with his homemade board is probably doing this, witch is how you should do it. (I think??)
Connect the led to digital input 1 and ground and write the same thing, the led will be high for 4 seconds and low for 1.
Renkku
@ Tue, 2008-07-01 18:01
What PIC
@ Tue, 2008-07-01 20:58
According to the manual from
According to the manual from sparkfu (see copy/paste below) it is either a PIC16F886 or a PIC16F872. I DO want to know why it is inverted. :)
• PICAXE-08 PIC12F629
• PICAXE-08M PIC12F683
• PICAXE-14M PIC16F684
• PICAXE-20M PIC16F677
• PICAXE-18 PIC16F627(A)
• PICAXE-18X PIC16F88
• PICAXE-28X1 PIC16F886
• PICAXE-28X2 PIC18F2420
• PICAXE-40X1 PIC16F887
• PICAXE-40X2 PIC18F4420
• PICAXE-18A PIC16F819
• PICAXE-28A PIC16F872
• PICAXE-28X PIC16F873A
• PICAXE-40X PIC16F874A
GobliZ - Check out my robots
@ Tue, 2008-07-01 21:37
One of FOUR!
OKay, this is progress, but "Lazy-boy Frits" doesn't say which chip he's using. Could be one of four:
• PICAXE-28X1 PIC16F886
• PICAXE-28X2 PIC18F2420
• PICAXE-28A PIC16F872
• PICAXE-28X PIC16F873A
Do we know what the pin number is of the offending DIO bit? Is it literally port C bit 5?
PS - You posted your message, like 30 seconds after mine above!!! Quit your moaning in the shoutbox!
@ Wed, 2008-07-02 10:12
One of four; Any!No
One of four; Any!
No diference, they all do it.
When I use portc's on drumsticks for instance, I have to start the code in the very top by making them all High, or the robot will start by taking sticks down before it does anything else.
@ Wed, 2008-07-02 22:04
RTFM - me
@ Tue, 2008-07-01 21:42
Can I moan here instead?
@ Tue, 2008-07-01 22:05
Someone talking about
Someone talking about setting a light on or off? I had a development board for some ARM chip once where there was 5V going to a test LED and through a resistor and finally into a pin. Then you had to set the pin to low to get the LED to light since of course you had to get the current flowing from 5V to GND... does this make sense to some of you? I might be in a totally different context or something :-)
Read the schematic for the development board in order to figure out if you have to set a pin high or low for something to turn on or off.
@ Tue, 2008-07-01 23:10
Correct!
You're quite right. Most transistors can sink more current than they can source. Consequently, they're more often used to "connect" to gnd (emitter side) than to connect to +V (collector side). (Yes, all you experts, I KNOW this is a simplification, but I'm pitching it for the audience. We're not electronics engineers. That would be, like, geeky, or whatever.)
Various PICs have an open drain output, which means the output can never go "positive." It can only be pulled to ground. I thought that might have been relevant, but on the 16F872, it's port A bit 4 and on the 16F886, it's port C bits 3 and 4 (but only in I2C mode). You can get a "logic high" out of them using a pullup resistor and switching the transistor "off," but it's not really the same thing as using a pull-up transistor.
So, I'm stumped. Even if I knew the chip, is the schematic for the development board available?
@ Tue, 2008-07-01 20:48
Erh - picaxe 28 :) Cant be
Erh - picaxe 28 :) Cant be bothered to look up what that is :) I'm cool thanks - I have learned that it is like that :)