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.

Which Pin only used to program the PIC

Status
Not open for further replies.
What are you using to power your PIC?

I can't remember if you mentioned it yet or not.
 
What are you using to power your PIC?

I can't remember if you mentioned it yet or not.

it including in picture that i post (training Kit) use socket 230VAC to DC i think it 12VDC because based on circuit i only see Vpp/Vcc/Vdd is 12v or 5v...
 
Make sure you're not putting 12 volts in where you should be providing 5 volts. That will give you the high voltage error.
 
Make sure you're not putting 12 volts in where you should be providing 5 volts. That will give you the high voltage error.

but i just connect jumper from PIC to ZIF socket with exact pin number... i got another problem when i do it on training kit it work but when i do it on protoboard/breadboard it not working. so i make simulation on Proteus ISIS and it show not working also...
Sch.jpg

Code:
#define LED_DIR TRISB7_bit
#define SW1_DIR TRISB0_bit
#define SW1_PIN RB0
#define LED_PIN RB7
void main() {
   while(1)        // continually
   {
      LED_DIR = 0;
      SW1_DIR = 1;
      if (SW1_PIN)                // if the switch is at logic one
      {
         LED_DIR = 0;          // turn the LED off
      }
      else
      {
         LED_DIR = 1;        // otherwise, flash LED one time
         delay_ms(200);
         LED_DIR = 0;
         delay_ms(200);
      }
   }
}
 
Sorry, I see what you mean.

You are aware that pushed switch will give you a 0 and not a 1, correct?

Do you want it to flash the light when the switch is pressed or if it's not pressed?

You said you're receiving an error, correct? A high voltage error?

Perhaps I should read back over this thread to pick up what I missed :p

Matt

EDIT: After a quick readthrough, it appears you never posted the actual error. Could you please copy and paste it into a post?

Thank you.
 
Sorry, I see what you mean.

You are aware that pushed switch will give you a 0 and not a 1, correct?

Do you want it to flash the light when the switch is pressed or if it's not pressed?

You said you're receiving an error, correct? A high voltage error?

Perhaps I should read back over this thread to pick up what I missed :p

Matt

the high voltage error the one that i want to test program PIC using training kit but just use jumper from the needed pin(PIC) to ZIF socket(TrainingKIt)...

the new post is new problem... ya if push switch it will give 0 cause go to ground maybe... if i press the switch it will on the LED...
 
the high voltage error the one that i want to test program PIC using training kit but just use jumper from the needed pin(PIC) to ZIF socket(TrainingKIt)...

the new post is new problem... ya if push switch it will give 0 cause go to ground maybe... if i press the switch it will on the LED...

Right, I think you'll want to change that to if (sw1_pin==0).

Also, are you remembering to load your code onto the pic in the simulator? :p;)
 
Right, I think you'll want to change that to if (sw1_pin==0).

Also, are you remembering to load your code onto the pic in the simulator? :p;)

ya i already loaded the code into PIC here with simulation log :
Untitled.jpg

if i put LED into pin RB0 which i code for SW1, and SW1 to pin RB7 which is code for LED... it work but got error message with logic contention detected... when i change and fix the error by put back the input and output pin to exact location, i cant even on when push the button...

Edit : i also try (sw1_pin==0) but still same...
 
ya i already loaded the code into PIC here with simulation log :
View attachment 72183

if i put LED into pin RB0 which i code for SW1, and SW1 to pin RB7 which is code for LED... it work but got error message with logic contention detected... when i change and fix the error by put back the input and output pin to exact location, i cant even on when push the button...

Edit : i also try (sw1_pin==0) but still same...

I'm asking if you could copy and paste the error, or show a screenshot of it. All you've shown us so far is the circuit and a working simulation log.
 
I'm asking if you could copy and paste the error, or show a screenshot of it. All you've shown us so far is the circuit and a working simulation log.

if u asking for that high voltage error, i do not have it... the training kit is in lab, i only can go there on Tuesday and Thursday... that why i want build programmer for myself...

if from the circuit that newly i post it do not show any error but not working...
 
i already solve my code error for the turn on/off led but still can not make it stay on/off until the push button hit again...

Code:
#define LED  RB7_bit
#define SW  RB0_bit


void main()
{
    TRISB7_bit=0x00;
    LED=0;
    TRISB0_bit=1;
    PORTB=0;
    
    while(1)
    {
        if(SW==0)
        {
            if(LED==1)
            {
             LED=1;
            }
            else if(LED==0)
            {
             LED=0;
            }
        }
        
        else if(SW==1)
        {
                 if(LED==1)
                 {
                  LED=0;
                 }
                 else if(LED==0)
                 {
                   LED=1;
                 }
        }
    }
}

this one will stop the blinking LED, if LED on=Off, if LED off=On but only as long the Push button is pressed... i want to make LED not On or even not blinking when receive voltage(initial condition), then i hit push button and release the LED will On, i hit again and release the LED will Off...

for the high voltage error i will post the screenshot when i able to catch it in Lab... I need postpone it because many assignment...
 
sorry i done that code too, i forgot logic gate and higher delay... any new beginner training manual using MikroC/MPLab IDE coding?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top