In this experiment we will show how to set MCU to count 8-bit in binary mode. The Counter will counts from 0(00h) to 255(FFh) with 1sec delay between each count. The output will be displayed on 8 L.E.Ds connected to PORT RB.0~RB.7
Button S1 and (pull-up) resistance with value of 4.7 K will provide the manual reset mode to the microcontroller.
ICSP connector provides the connection between the programmer (PicKit 2) and microcontroller (PIC16F628A).
I have to mention the fact that in video below I reduced the time between each count, to be more viewable all 8 bits.
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.03:
' 8-bit Binary counter
' Written by:
' Aureliu Raducu Macovei, 2010.
' Description:
' In this experiment we will show how to set MCU to count 8-bit in binary mode.
' The output will be displayed on 8 LEDs connected to PORT RB.0~RB.7
' 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()
{
TRISB = 0x00; //SET PORTB TO BE OUTPUT;
PORTB = 0x00; //TURN OFF LEDs ON PORTB;
do {
PORTB++; //INCREMENTS;
Delay_ms(1000); //WAIT 1S;
}while(1); //INFINITE LOOP;
}
i think it will be more helping if u explain more in those coding
ReplyDelete