5 April, 2012 (16:43) | Electronics, PIC microcontroller | By: xenon ark
This is a funny project for beginners. The tutorial will show how to control two I/O of PIC12F675. There is no external xtal included in the schematic. We use internal RC. To set internal RC in MikroC PRO IDE goto Project>Edit Project>Oscillator>Internal RC No Clock
here is the schematic:

the MikroC Source codes:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
void init_ports(void) {
TRISIO = 0; // set as output
}
void main()
{
init_ports();
while(1)
{
GPIO = (1<<2);
delay_ms(50);
GPIO = 0;
delay_ms(50);
GPIO = (1<<2);
delay_ms(50);
GPIO = 0;
delay_ms(500);
GPIO = (1<<4);
delay_ms(50);
GPIO = 0;
delay_ms(50);
GPIO = (1<<4);
delay_ms(50);
GPIO = 0;
delay_ms(500);
}
} |
Tags: LED, MikroC, PIC12F675
Comments: -
24 September, 2011 (20:35) | Electronics, PIC microcontroller | By: xenon ark
This is a very easy tutorial to connect a PIC with an LCD. The program is written by mikroC PRO 4.60 Check the LCD library from the library manager before compiling the program.
the program:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| // LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
void main(){
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,2,"PIC16F877A LCD"); // Write text in first row
Lcd_Out(2,3,"control7.net"); // Write text in second row
} |
The Schematic:

Demo run:

mikroC download
Download mikroC from here.
Tags: LCD, PIC mocrocontroller, PIC tutorial, PIC16F877a
Comments: -
19 April, 2011 (03:58) | AVR Microcontroller, Electronics | By: xenon ark
There are several character LCD available in market 16×2, 16×4, 20×2 etc. these are very useful and pretty cheap also. This is a small program to demonstrate how interfacing LCD with AVR. I have used Atmega8 to run the program.
This is the schematic:

Pinout chart:

LCD in action:

Source code:
Download source codes. (VAR studio 4 required)
Tags: AVR, AVR GCC, LCD
Comments: 1
Recent Comments