In this experiment we will show how to set MCU to make a LED blinking. PORTB will be used to show that.
Button S1 and (pull-up) resistance with value of 4.7 K will provide the manual reset mode the microcontroller.
ICSP connector provides the connection between the programmer (PicKit 2) and microcontroller (PIC6F628A).
Circuit Diagram:
For those who want to build it on their own breadboard or other platform, here is the electronic scheme built in Eagle Cad, free version:
Software:
Here is the C program written for MikroC PRO for PIC 2010 (version v4.15).
/*
'*******************************************************************************
' Lesson nr.02:
' Blink a LED (Blink entire PORTB)
' Written by:
' Aureliu Raducu Macovei, 2010.
' Description:
' In this experiment we will show how to set MCU to make a LED blinking.
' PORTB will be used to show that.
' Test configuration:
' MCU: PIC16F628A
' Test.Board: WB-106 Breadboard 2420 dots
' SW: MikroC PRO for PIC 2010 (version v4.15)
' Configuration Word
' Oscillator: INTOSC:I/O on RA.6, I/O on RA.7
' Watchdog Timer: OFF
' Power up Timer: Disabled
' Master Clear Enable: Enabled
' Browun Out Detect: Enabled
' Low Voltage Program: Disabled
' Data EE Read Protect: Disabled
' Code Protect: OFF
'*******************************************************************************
*/
void main() //MAIN;
{
TRISB = 0x00; //SET PORTB TO BE OUTPUT;
PORTB = 0x00; //TURN OFF LEDs ON PORTB;
while(1){ //INFINITE LOOP;
PORTB = ~PORTB; //INVERT STATE ON PORTB;
Delay_ms(1000); //WAIT 1S;
}
} //END;
Hello!
ReplyDeleteI have many problem while using PIC 16F628A.
1st: can u teld me the range of voltage for this PIC? i need to use it with 4.2V-4.3V for simple power diagram.
2nd: i used exactly this blink led code but it not work, (power was set in range 4.2v - 5V). Did i forget config something?
it's all for newbie. will be more after this is solved.
Thank you!
Hope you still manager this page.
Solved! Master Clear Enable pin, must set disable.
ReplyDelete