Let's Make Robots!

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!?!?!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

(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

 

I may have an answer. Tell me what type of PIC is embedded.

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

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!

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. 

OKay, I'm intrigued. Where do I get the technical manual that might tell me how picaxe "ports" map onto PIC ports?
Can I moan here instead? Since this is way off topic I'll try to steer the ship around... Is it actually setting the in to low which makes the out high or vise versa? In other words I'm not turning the light off I'm turning it "not on" or setting the ON status to low.

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.

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?

Erh - picaxe 28 :) Cant be bothered to look up what that is :) I'm cool thanks - I have learned that it is like that :)