Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About veenie

  • Rank
  1. hello jorgeF, thank you for your answer, I tried to use the uitoa function but couldn't get it to work on the lcd. So if you have any example code maybe i could find what i've did wrong.
  2. Hello, I'm quit new to programming with C, I've done some basic stuff at school couple of years ago but it never was my thing. Well after a few years it's still whispering in my ears that i should learn how to program. For school I;ve bought the Sourceboost Boostc Pro 6.xx license. And still own this license. Found out that a lot has changed since the version I had (6.40) so updated to 6.97 latest version of 6.xx At the moment i;m just playing around to learn how to program. Only walking in to two problems at this moment. I'm using the lcd driver from lika.be http://lika.be/wp/2005/08/boostc-compiler-libraries/ Well I can send commands to the LCD. that all worked fine. But what I can't figure out is how to move the cursor to a specific place at the display. gotoxy doesnt seem to work. The next problem I walked in to was that i could not place the interrupt tmr0 result at the display. Well I;ve found a way to convert it so it shows the value at the lcd now. But it's using way to much rom of my PIC16F627A about 35% just for the conversion. Are there any replacement commands for the sprintf conversion to show the value on the display? This is the code I;ve made so far: #pragma DATA 0x2007, 0x2118 #pragma CLOCK_FREQ 4000000 #include <system.h> #include <stdlib.h> #include <stdio.h> #include "lcd_test.h" #include "lcd.h" unsigned int rx_out; void init(void) // Configureren van de settings { //Config //76543210 trisa = 00100000b; // Stel de in / uitgangen op port A in. trisb = 00000001b; // Stel de in / uitgangen op port B in. porta = 00000000b; // Alle pennen poort a zijn laag portb = 00000000b; // Alle pennen poort b zijn laag //rx_out = 0; //Configuratie Timer0 option_reg.T0CS = 0; // 0 = Gebruik systeemklok, 1 = Gebruik klok op pin T0CKI option_reg.T0SE = 0; // bit 4 TMR0 Source Edge Select bit 0 = low/high 1 = high/low option_reg.PSA = 0; // 0 = Prescaler voor Timer0, 1 = Prescaler voor WatchDogTimer WDT option_reg.PS2 = 0; // PS0 - PS2 Prescaler waarde zie datasheet option_reg.PS1 = 1; option_reg.PS0 = 0; option_reg.INTEDG = 1; // Interrupt als portb.0 ? wordt. set_bit(intcon,GIE); // Interrupts activeren. set_bit(intcon,INTE); // Interrupt PortB.0 is actief = 1, Uitgeschakeld = 0. // LCD interface lcd_init(); // LCD initialiseren lcd.c / lcd.h / lcd_test.h lcd_send_cmd(LINE1); // Stuur LCD naar regel 1 lcd_printf("Test 1"); // Plaats de volgende tekst op het lcd lcd_send_cmd(LINE2); // Stuur LCD naar regel 2 lcd_printf("Regel 2"); // Plaats de volgende tekst op het lcd delay_s(2); // Wacht 3 seconden (start op scherm) return; } void main() { init(); // Eerst alle settings goed zetten char buffer[5]; // Buffer aanmaken voor conversie naar LCD lcd_send_cmd(DISP_CLR); // Display leegmaken while(1) // Start van de programma Loop { sprintf(buffer, "%5d", rx_out); // Conversie int naar string lcd_send_cmd(LINE1); // Stuur LCD naar regel 1 lcd_printf(buffer); // Plaats de volgende tekst op het lcd delay_ms(10); // wacht 0,1 seconde voor refresh } } void interrupt( void ) // Interrupt routine { if(test_bit(intcon,INTF)) // Controleer algemene interrupt vlag { if(option_reg.INTEDG == 1) // Controleer status portb.0 interrupt { tmr0 = 0; // Reset tmr0. intcon.T0IE = 1; // option_reg.INTEDG = 0; // Zet portb.0 interrupt op laag intcon.INTF = 0; // Reset interrupt vlag return; } else { rx_out = tmr0; // Schrijf waarde tmr0 weg naar rx_out intcon.T0IE = 0; // option_reg.INTEDG = 1; // Zet portb.0 interrupt op hoog intcon.INTF = 0; // Reset interrupt vlag return; } } } I've tried the dutch forum www.circuitsonline.nl for help and also have tried a lot of things myself but i seem pretty stuck for now.
  • Create New...