Posts

Showing posts with the label PIC16F887

PIC16F887 877 programming in C Tutorial 7 LCD Moving Display n Custom Characters

Image
LCD; Moving Display & Custom Character : You can display your custom characters by using mikroc custom character tool. Go to tools>>customer character then make the character you want to display. After this click on 'generate code'. It will generate a customchar function just copy and paste above the main function. customchar has two parameters; row and position in that row. Just pass these parameters where you want to see your custom character on LCD. You can also move the text, left and right, on LCD screen; by using the LCD commands. _LCD_SHIFT_LEFT and   _LCD_SHIFT_RIGHT are the commands. There are various other commands in mikroc, i forget to tell you in lcd tutorial, these are: LCD Commands Now lets write a code to display and move the custom character, back and forth, (of your choice) on LCD screen. Code: // 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 ...

PIC16F887 877 programming in C Tutorial 3 1 Timer 0

Image
Timers Both PIC16f887 and 877 have three timers; timer 0, timer 1, and timer 2. Timer 0 is 8-bit and can also be use as counter, Timer 1 is 16-bit timer as well as a counter, where as Timer 2 is 8-bit timer and can be used as the PWM time base for the PWM mode of the CCP module(s).  Timer 0: The Timer0 module timer/counter has the following features: 8-bit timer/counter Readable and writable 8-bit software programmable prescaler Internal or external clock select Interrupt on overflow from FFh to 00h Edge select (rising or falling) for external clock Timer mode is selected by clearing bit T0CS (OPTION_REG<5>). In Timer mode, the Timer0 module will increment every instruction cycle (without prescaler). Counter mode is selected by setting bit T0CS (OPTION_REG<5>). In Counter mode, Timer0 will increment either on every rising or falling edge of pin RA4/T0CKI. The incrementing edge is determined by the Timer0 Source Edge Select bit, T0SE (OPTION_REG<4>). Clearing bit T...