this one is blinking properly.. I edited your circuit as well
Zip up your current MikroC and Proteus project and upload it.
I attempt to troubleshoot here.
BigDog
Ok, thank you for verification.
Erm I have set my MikroC oscillator setting to "internal oscillator block on port RA6 and RA7".
When I run the proteus, I got error simulation which is shown below:
View attachment 61131
You forgot to initialize the OSCCON register for an INTOSC of 8MHz.
Reference the PIC18F4520 Datasheet, pg. 29 & 30, Section 2.7.1 OSCILLATOR CONTROL REGISTER and the following OSCCON Configuration Table.
OSCCON is the Internal Oscillator Control Register and must be configured correctly for the Internal Oscillator to run at a desired frequency.
When you failed to configure this register, the Internal Oscillator was running at a default frequency of 1MHz.
There is also a preference setting in the PIC simulation block which must be set to allow the FOSC/4 clock to be output on the CLKOUT pin.
BigDog
All PIC SFR registers and their bits are implicitly declared as global variables. These identifiers have an external linkage, and are visible in the entire project. When creating a project, the mikroC PRO for PIC will include an appropriate (*.c) file from defs folder, containing declarations of available SFR registers and constants.
For a complete set of predefined globals and constants, look for “Defs” in the mikroC PRO for PIC installation folder, or probe the Code Assistant for specific letters (Ctrl+Space in the Code Editor).
....
....
sfr unsigned short volatile SSPBUF absolute 0x0FC9;
sfr unsigned short volatile T2CON absolute 0x0FCA;
sfr unsigned short volatile PR2 absolute 0x0FCB;
sfr unsigned short volatile TMR2 absolute 0x0FCC;
sfr unsigned short volatile T1CON absolute 0x0FCD;
sfr unsigned short volatile TMR1L absolute 0x0FCE;
sfr unsigned short volatile TMR1H absolute 0x0FCF;
sfr unsigned short volatile RCON absolute 0x0FD0;
sfr unsigned short WDTCON absolute 0x0FD1;
sfr unsigned short volatile HLVDCON absolute 0x0FD2;
sfr unsigned short volatile LVDCON absolute 0x0FD2;
sfr unsigned short volatile OSCCON absolute 0x0FD3;
sfr unsigned short volatile T0CON absolute 0x0FD5;
sfr unsigned short volatile TMR0L absolute 0x0FD6;
sfr unsigned short volatile TMR0H absolute 0x0FD7;
sfr unsigned short volatile STATUS absolute 0x0FD8;
.....
.....
According to the MikroC documentation:
Reference the P18F4520.c file in the "Defs" directory, the directory contains files similar to the header files used by normal C compilers.
Most of the Special Function Register (SFR) names in the devices datasheet are available in the MikroC compiler.
BigDog
Nice explaination. Thank you BigDog.
Now I having LCD hardware display problem, when I connect voltage supply, LCD display only shows two rows of black dots with several columns instead of first row black dots.
Sounds like a LCD initialization issue or possibly a contrast setting issue.
Are you using the MikroC LCD Library for your LCD driver?
Can you post your code and a schematic for the design?
BigDog
What I know is, when we all just connect GND & Vee to GND ; VCC & E to Vcc(5V).
The LCD 16x2 will display one first row with 16 dark square box.
I think I spoiled the LCD.
Last time I post the thread about LCD & PIC18F4520 & MikroC, it works.
But somehow now, when I connect simple connection just to test the hardware LCD is working or not but it's not working now.
Here's the attachment pic :
View attachment 61179View attachment 61180View attachment 61181
What I know is, when we all just connect GND & Vee to GND ; VCC & E to Vcc(5V).
The LCD 16x2 will display one first row with 16 dark square box.
I think I spoiled the LCD.
By the way, I want confirm the mikroC SD/MMC library only supported for the PIC18 series not PIC16F8870 due to RAM memory insufficient.
Am I correct ?
Notes:
- Library works with PIC18 family only;
- The library uses the SPI module for communication. User must initialize
SPI module before using the SPI Graphic Lcd Library.
- For MCUs with two SPI modules it is possible to initialize both of them and
then switch by using the SPI_Set_Active() routine.
- Routines for file handling can be used only with FAT16 file system.
- Library functions create and read files from the root directory only;
- Library functions populate both FAT1 and FAT2 tables when writing to files,
but the file data is being read from the FAT1 table only; i.e. there is no
recovery if FAT1 table is corrupted.
Reference the MikroC Pro User Manual, pg 368, Section MULTI MEDIA CARD LIBRARY:
MikroC Pro User Manual
Yes, you are correct.
BigDog
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?