![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hello, I am trying to use an 18F2520 with a GLCD and it seems to be running really slow. The GLCD fill command takes about 5-7 seconds to finish. Here is the code that I am using with the mikroC compliler. Code: void main()
{
TRISA = 0xff;
TRISB = 0x00;
TRISC = 0x00;
PORTB = 0x00;
PORTC = 0x00;
ADCON1 = 0x0f;
OSCCON = 0x07;
OSCTUNE = 0x40;
Glcd_Init(&PORTC,1,0,2,4,6,5,&PORTB);
Glcd_Fill(0);
Glcd_Set_Font(FontSystem5x8, 5, 8, 32);
Glcd_Write_Text("TEST",0,0,1);
} I am also using the default project fuses. Thanks | |
| |
| | (permalink) |
| What crystal are you using? | |
| |
| | (permalink) |
| Doing OSCCON = 0x07 selects the internal oscillator at 32kHz. Try OSCCON = 0x72 for the internal 8MHz clock or OSCCON = 0x00 if you have an external crystal. If you have an external crystal then you may have to set the fuses appropriately. Mike. | |
| |
| | (permalink) |
| Unbelievable! The OSCCON was supposed to be set to 0x70, not 0x07. Thanks so much for noticing that. It works perfectly now, thanks. | |
| |
| | (permalink) |
| It's amazing how often the error is a simple typo but almost impossible to spot without a fresh set of eyes. Mike. | |
| |