DIGITAL INPUT OF PIC16F628A

General discussion on mikroElektronika website & forums.
Post Reply
Author
Message
mymbong
Posts: 5
Joined: 28 Nov 2014 13:39

DIGITAL INPUT OF PIC16F628A

#1 Post by mymbong » 05 Jun 2015 07:17

what's wrong with this code? i test it to proteus 8 its perfectly working but in the real hardware not working

here is my code compile in mikroC pro

Image

Image

testing in proteus

Image

bad output in real hardware

Image

please any help will be appreciated

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: DIGITAL INPUT OF PIC16F628A

#2 Post by Aleksandar.Mitrovic » 05 Jun 2015 10:06

Hi,

Can you please attach your project in small zipped form how could I will be able to exam it?

Please note that Proteus is not fully supported software by mikroElektronika.

Best regards,
Aleksandar

mymbong
Posts: 5
Joined: 28 Nov 2014 13:39

Re: DIGITAL INPUT OF PIC16F628A

#3 Post by mymbong » 05 Jun 2015 23:44

thanks Aleksandar.Mitrovic for your quick response of my post

actually the project is interfacing PIC to VB.net

here is my code
PIC16F628A.zip
(19.64 KiB) Downloaded 160 times
im using PICPGM programmer software and JDM programmer

here is the screenshot of successfully program in PICPGM software
programm finish.jpg
programm finish.jpg (347.44 KiB) Viewed 4493 times
here is the output when i press the button, using MikroC UART Terminal
MikroC UART Terminal.jpg
MikroC UART Terminal.jpg (340.08 KiB) Viewed 4493 times
please i really need help

mymbong
Posts: 5
Joined: 28 Nov 2014 13:39

Re: DIGITAL INPUT OF PIC16F628A

#4 Post by mymbong » 08 Jun 2015 23:21

any help please...

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: DIGITAL INPUT OF PIC16F628A

#5 Post by Aleksandar.Mitrovic » 11 Jun 2015 10:00

Hi,

I apologize for long waiting on answer.

I tested this code on EasyPIC v7 development board with internal oscillator 4MHz and its working:

Code: Select all

void main() {
   CMCON = 0x07;
   PORTA = 0x00;
   TRISA = 0x0F;

   UART1_Init(9600);
   Delay_ms(100);
   UART1_Write(13);
   UART1_Write(12);
while (1){
   //PORTA
  if (RA0_bit == 1){
   UART1_Write_Text("RA0");
   Delay_ms(1000);
  }
  if (RA1_bit == 1){
   UART1_Write_Text("RA1");
   Delay_ms(1000);
  }
  if (RA2_bit == 1){
   UART1_Write_Text("RA2");
   Delay_ms(1000);
  }
  if (RA3_bit == 1){
   UART1_Write_Text("RA3");
   Delay_ms(1000);
  }
  if (RA4_bit == 1){
   UART1_Write_Text("RA4");
   Delay_ms(1000);
  }
 }
}
Note that if you are using this board set J17 in VCC and all pins which you use in PULL DOWN position.

Best regards,
Aleksandar

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: DIGITAL INPUT OF PIC16F628A

#6 Post by Aleksandar.Mitrovic » 11 Jun 2015 10:00

Hi,

I apologize for long waiting on answer.

I tested this code on EasyPIC v7 development board with internal oscillator 4MHz and its working:

Code: Select all

void main() {
   CMCON = 0x07;
   PORTA = 0x00;
   TRISA = 0x0F;

   UART1_Init(9600);
   Delay_ms(100);
   UART1_Write(13);
   UART1_Write(12);
while (1){
   //PORTA
  if (RA0_bit == 1){
   UART1_Write_Text("RA0");
   Delay_ms(1000);
  }
  if (RA1_bit == 1){
   UART1_Write_Text("RA1");
   Delay_ms(1000);
  }
  if (RA2_bit == 1){
   UART1_Write_Text("RA2");
   Delay_ms(1000);
  }
  if (RA3_bit == 1){
   UART1_Write_Text("RA3");
   Delay_ms(1000);
  }
  if (RA4_bit == 1){
   UART1_Write_Text("RA4");
   Delay_ms(1000);
  }
 }
}
Note that if you are using this board set J17 in VCC and all pins which you use in PULL DOWN position.

Best regards,
Aleksandar

mymbong
Posts: 5
Joined: 28 Nov 2014 13:39

Re: DIGITAL INPUT OF PIC16F628A

#7 Post by mymbong » 12 Jun 2015 05:21

thank you so much Aleksandar.Mitrovic your very helpful answer
now its working...

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: DIGITAL INPUT OF PIC16F628A

#8 Post by Aleksandar.Mitrovic » 12 Jun 2015 08:56

Hi,

Your welcome.
I'm glad that I was able to help you.

Regards,
Aleksandar

Post Reply

Return to “Website & Forums General Discussion”