View previous topic :: View next topic |
Author |
Message |
hoa35ktxd
Joined: 23 Nov 2014 Posts: 27 Location: Vietnam
|
How to Output_high and Output_low on Pin_A1 PIC16F690 |
Posted: Mon Jan 19, 2015 11:06 pm |
|
|
My code:
Code: |
Output_high(Pin_A1);
Delay_ms(500);
Output_Low(Pin_A1);
Delay_ms(500); |
But it not work.
Why and how to fix this problem.
Thanks. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 20, 2015 12:11 am |
|
|
You need an #include for the PIC, and #fuses and #use delay()
statements. Try this program:
Code: |
#include <16F690.H>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT
#use delay(clock=4M)
//====================================
void main()
{
while(1)
{
output_high(PIN_A1); // Blink LED
delay_ms(500);
output_low(PIN_A1);
delay_ms(500);
}
}
|
However, be aware that Pin A1 is used by your ICD debugger and
programmer. My advice is to blink another pin, such as pin B6. |
|
|
hoa35ktxd
Joined: 23 Nov 2014 Posts: 27 Location: Vietnam
|
|
Posted: Tue Jan 20, 2015 6:48 am |
|
|
Thank you.
Your code are not work.
I need only PIN_A1. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 20, 2015 12:42 pm |
|
|
It works for me. I used a Microchip Low Pin Count board with a 16F690
installed in it:
http://www.microchip.com/_ImagedCopy/DM164130-9.png
I compiled the program that I posted, and programmed it into the 16F690
with a Pickit3 programmer. Then I jumpered from Pin A1 to Pin C0,
because that board only has LEDs on pins C0 to C3.
Pin C0 is in a high-Z state, so it doesn't control anything. Only the signal
from Pin A1 controls the LED. It's blinking. It works. |
|
|
|