yo creo que es lo mas simples de entender en ccs e es facil
por exemplo si quieres usar un 16f84 tendras que poner esto
#include <16F84A.H>
si quieres usar un 16f877 esto tendrias que poner
#include <16F877A.H>
si usas LCD esto tendrias que estar
#include <MI LCD .H>( la controladora de lcd que uses )
este es un exemplo que me esta dando dolores de cabeca no esta completo ya que mal consigo acer funcionar la lcd pero sirve para lo que queremos la idea es acer que en una lcd nos diga la fecha , la hora ,que me despierte si es tarde
e todas essas cosas que se puede acer com el DS1307 #include <16F628.H>//el processador
#include <DS1307.H>//libreria del relo ds1307
#use standard_io ( A )
#use standard_io ( B )
#use delay ( clock = 6000000 )
/* LCD STUFF */
#define LCD_D0 PIN_B4
#define LCD_D1 PIN_B5
#define LCD_D2 PIN_B6
#define LCD_D3 PIN_B7
#define LCD_EN PIN_B1
#define LCD_RS PIN_B2
#define FIRST_LINE 0x00
#define SECOND_LINE 0x40
#define CLEAR_DISP 0x01
#use standard_io ( A )
#use standard_io ( B )
//#use standard_io ( C )
void LCD_Init ( void );
void LCD_SetPosition ( unsigned int cX );
void LCD_PutChar ( unsigned int cX );
void LCD_PutCmd ( unsigned int cX );
void LCD_PulseEnable ( void );
void LCD_SetData ( unsigned int cX );
/******************************************************************************/
void main ( void )
{
char cX;
// initilize screen
LCD_Init();
// delay_us(45);
LCD_PutCmd ( CLEAR_DISP );
//delay_us(45);
LCD_SetPosition ( FIRST_LINE );
printf ( LCD_PutChar, "" );
LCD_SetPosition ( SECOND_LINE );
printf ( LCD_PutChar, " v1.1 " );
delay_ms ( 100 );
LCD_SetPosition ( FIRST_LINE );
printf ( LCD_PutChar, "" );
LCD_SetPosition ( SECOND_LINE );
printf ( LCD_PutChar, "" );
}
void LCD_Init ( void )
{
LCD_SetData ( 0x00 );
delay_ms ( 400 ); /* wait enough time after Vdd rise */
output_low ( LCD_RS );
LCD_SetData ( 0x03 ); /* init with specific nibbles to start 4-bit mode */
LCD_PulseEnable();
LCD_PulseEnable();
LCD_PulseEnable();
LCD_SetData ( 0x02 ); /* set 4-bit interface */
LCD_PulseEnable(); /* send dual nibbles hereafter, MSN first */
LCD_PutCmd ( 0x2C ); /* function set (all lines, 5x7 characters) */
LCD_PutCmd ( 0x0C ); /* display ON, cursor off, no blink */
LCD_PutCmd ( 0x01 ); /* clear display */
LCD_PutCmd ( 0x06 ); /* entry mode set, increment */
}
void LCD_SetPosition ( unsigned int cX )
{
/* this subroutine works specifically for 4-bit Port A */
LCD_SetData ( swap ( cX ) | 0x08 );
LCD_PulseEnable();
LCD_SetData ( swap ( cX ) );
LCD_PulseEnable();
}
void LCD_PutChar ( unsigned int cX )
{
/* this subroutine works specifically for 4-bit Port A */
output_high ( LCD_RS );
LCD_SetData ( swap ( cX ) ); /* send high nibble */
LCD_PulseEnable();
LCD_SetData ( swap ( cX ) ); /* send low nibble */
LCD_PulseEnable();
output_low ( LCD_RS );
}
void LCD_PutCmd ( unsigned int cX )
{
/* this subroutine works specifically for 4-bit Port A */
LCD_SetData ( swap ( cX ) ); /* send high nibble */
LCD_PulseEnable();
LCD_SetData ( swap ( cX ) ); /* send low nibble */
LCD_PulseEnable();
}
void LCD_PulseEnable ( void )
{
output_high ( LCD_EN );
delay_us(10);
output_low ( LCD_EN );
delay_ms(5);
}
void LCD_SetData ( unsigned int cX )
{
output_bit ( LCD_D0, cX & 0x01 );
output_bit ( LCD_D1, cX & 0x02 );
output_bit ( LCD_D2, cX & 0x04 );
output_bit ( LCD_D3, cX & 0x08 );
}