Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

is my code right??

Status
Not open for further replies.

crzy engineer

New Member
hey guys im a newbie here,

completly new to pics and i learned this code this week:D

well im in this assignment to write a code for the pic 12F509

this instruction here is gonna be the very first set of instructions the pic is gonna perform

does it usually just start like this or am i missing something???

i have a feeling "org0" should be at the very first line???



Code:
LOOP:
IF GP3 = 1 THEN   'Switch pin
HIGH GP3   'Motor pin
PAUSE 6000
LOW GP3
ELSE
LOW GP3
ENDIF
GOTO LOOP

Any suggestions or mod?

THANKS
 

Attachments

  • Deer feeder.jpg
    Deer feeder.jpg
    79.7 KB · Views: 146
It looks right except the motor pin is GP4. Does the basic you are using automatically set the pin to output when you use the LOW/HIGH command? Which compiler are you using?

Mike.
 
It looks right except the motor pin is GP4. Does the basic you are using automatically set the pin to output when you use the LOW/HIGH command? Which compiler are you using?

Mike.

hey mike
hmm i never thought about the setting of the pin.

i bought a pickit 2 and im using mplab
 
Not sure about this BUT I think gp3 is master clear and needs a pull up resistor,
so the button should take it low. and in the fuses you would need to turn _MCLRE_OFF
double check me on this
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top