MikroC & SD CARD & PIC18F4520

Status
Not open for further replies.
this one is blinking properly.. I edited your circuit as well

Hi, the file's corrupted.
Can you reupload again ?

P/S: Why you working on port C and do blinking code ?
I want to test out the output from the oscillator CLKOUT and CLKIN pin 13 & 14.
 
Last edited:

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

pls use this setting and try
1001 = Internal oscillator block, CLKO function on RA6; port function on RA7
 

Attached is the fixed project with FOSC/4 on CLKOUT PIN with a scope attached to the CLKOUT PIN showing a 2MHz signal.

You forgot to initialize the OSCCON register for an INTOSC of 8MHz.

BigDog
 

Attachments

  • Linspire.zip
    51.9 KB · Views: 137

You forgot to initialize the OSCCON register for an INTOSC of 8MHz.

Thank you,but how do you know what's this "OSCCON" term intialized in MikroC and value set ?
 

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
 

Yap, I'm understandstand thank you for explainantion.
Another question, How'd I know the "term" MikroC they provided or defined them in order to match the PIC datasheet register term defined like

In PIC18F4520 datasheet: "OSCCON"
In MikroC Pro : "OSCCON"

Another simple example:
In PIC18F4520 datasheet: TRISB
In MikroC Pro : TRISB1_BIT or TRISB2_BIT ..etc

Hope my question does not borther you.
 

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.
 

Nice explaination. Thank you BigDog.

No Problem.
I'm more than happy to try and answer any of your question.


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
 
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
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

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 :



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.
 

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.

I would use a 10KΩ pot on the contrast pin rather than tie it to ground. The Vee contrast pin attaches to the center arm of the pot with the other pot pins attached to GND and Vcc respectfully.

In a pinch you could use two 5KΩ resistors as a voltage divider with the Vee contrast pin attached between the two.

BigDog
 


you have to connect the E pin and RS to the microcontroller and R/w to ground.after writing command/data to the lcd data bus a pulse should be given on the E pin to transfer the command or data to lcd.if one row of lcd is with dark squares when u give the supply then its working, but the commands are not properly recieved.have a look at this pic https://www.extremeelectronics.co.in/pictutorials/images/pic_lcd_interface_schematic.gif
 

Hi guys,
Thank you for your several opinions here.
However, I have two LCD has this kind of conditions, yet I dont have spare right now.
I test another one tomorrow.

I will update you guys then.
 

Guys,
I have burn out my PIC18F4520 due to static charges.
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 ?


Regards,
Linspire
 

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 ?

Reference the MikroC Pro User Manual, pg 368, Section MULTI MEDIA CARD LIBRARY:

MikroC Pro User Manual


Yes, you are correct.

BigDog
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…