ABL electronic PIC12 Personal Computer User Manual


 
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
24 2
MikroElektronika:
Development
tools
-
Books
-
Compilers
page
Hardware Connection
Library Example
4MHz
+5V
+5V
PIC16F877A
RA0/AN0
RA2/AN2/Vref-
RA3/AN3/Vref+
RA4/TOCKI
RA5/AN4
RE0/RD/AN5
RE1/WR/AN6
RE2/CS/AN7
Vdd
Vss
OSC1
OSC2
RCO/T1OSO
RC1/T1OSI
RC3
RD0/PSP0
RD1/PSP1
MCLR/Vpp/THV
RC2/CCP1
RA1/AN1
RB7/PGD
RB6/PGC
RB5
RB4
RB3/PGM
RB2
RB1
RB0/INT
Vdd
Vss
RD6/PSP6
RD7/PSP7
RD5/PSP5
RD4/PSP4
RC7/RX/DT
RC6/TX/CK
RC5
RC4
RD3/PSP3
RD2/PSP2
330R
10K
Reset
/*The example changes PWM duty ratio on pin RC2 continually. If LED is connected
to RC2, you can observe the gradual change of emitted light. */
char i = 0, j = 0;
void main() {
PORTC = 0xFF;
// PORTC is output
Pwm_Init(5000);
// Initialize PWM module at 5KHz
Pwm_Start();
// Start PWM
while (1) {
// Slow down, allow us to see the change on LED:
for (i = 0; i < 20; i++) Delay_us(500);
j++;
Pwm_Change_Duty(j);
// Change duty ratio
}
}