Hola amigos del foro, mi pregunta va dirigida al hecho de que no logro meter un valor cambiante en el LCD, en este caso el valor de PWM convertido a su voltaje equivalente, es todo lo que tiene que mostrar el LCD. Mi código lo tengo así (el compilador es MikroC, no se necesita poner los códigos de inicialización):
// 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() {
TRISC2_bit = 0;
PWM1_Init(500);
PWM1_Start();
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
while(1) {
unsigned int counter, volt, Buffer;
for (counter=0; counter<255; counter ++) {
PWM1_Set_Duty(counter);
Delay_ms(50);
}
volt = (counter + (1/6))/51;
LCDPutStr("V actual: ");
sprintf(Buffer, "%.3g", volt);
LCDPutStr(Buffer);
LCDPutStr(" ");
}
}
Sin embargo, MikroC no acepta los comandos "LCDPutStr", y este código también tengo mis dudas que pueda mostrar el valor en el LCD, por lo que pido su ayuda para opciones para poder mostrar en el LCD el texto y el valor de voltaje (el PWM si esta funcionando). Un saludo.