ex51.c doesn't work but lcd.hex does

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
dobbers
Posts: 2
Joined: Mon Jul 31, 2006 10:35 pm
Contact:

ex51.c doesn't work but lcd.hex does

Post by dobbers »

I have recently purchased the following:
  • EB006 multiprogrammer board (fitted with a PIC 16F88)
    EB005 LCD E-blocks board
    C4PICs3
I installed the PPP, MPASM and C4PICs without any problems. I used the lcd.hex code that came on the PPP CD to test the LCD board and it worked a treat showing a counter counting up.
I then used the ex51.c code on the C4PIC CD and it builds fine but I get nothing on my LCD.
Is there something I am missing here? The board and LCD must be okay as they work with the lcd.hex code. Is there something I need to do to the C code in ex51.c to make it work with the 16F88 present in my board?

regards,

dave

Ian
Posts: 110
Joined: Thu Sep 29, 2005 10:53 am
Location: Matrix Multimedia
Been thanked: 1 time
Contact:

Post by Ian »

It may be a clock or configuration setting problem.

Firstly check that you have LVP disabled.
LVP (Low Voltage Programming) uses Pin B3 which will prevent the LCD from working (unless you modify your program and use the LCD patch system).
Check as well that the Watchdog timer is off unless you are specifiically using it.

Next check your oscillator settings. It may be that the timings are out if the clocks are not working at the speeds the code expects.
Try it with the simple config mode and XT, or HS in the advanced config mode.

The folowing post discusses F88 internal clock settings and might be useful.
http://www.matrixmultimedia.com/mmforum ... c.php?t=82

Further details of F88 oscilator settings can be found in the F88 datasheet.

One final thing whilst we on the F88 is that you will need to turn off the aalogue inputs/comparators to be able to use those pins for digital IO.
Flowcode for instance sets the following for the F88:

ansel = 0;
cmcon = 0x07;

Notes on this from C 4 PICs:
"For some PICmicro devices other than the PIC16F84, certain extra capabilities of the chip may be turned on by default.

For example the PIC16F87x series have analogue capability on PORTA which is enabled by default, meaning that PORTA cannot be used for digital I/O unless this analogue capability is specifically disabled within your own code by setting the ADCON1 register to 0x06. If you have got one of these chips we will be using the analogue feature (and seeing how to turn it off from C) in lab 10.

Similarly, the PIC16F627 device has an analogue comparator function on PORTA which should be turned off by setting the CMCON register to 0x07.
"

dobbers
Posts: 2
Joined: Mon Jul 31, 2006 10:35 pm
Contact:

source for lcd.hex available?

Post by dobbers »

Thanks for the reply Ian. I checked and according to PPP -> PIC Micro settings, LVP is disabled and Watchdog is also disabled.

I have connected the LCD board to Port B so disabling analogue ports for Port A is not going to help me.

So last thing to check is the clock frequency - I'll have a look at the post you suggested regarding clock frequency.

Is it possible to publish the assembler source that generated lcd.hex as the timing method in this seems to work.

regards,

dave

Dannny121212
Posts: 3
Joined: Sun Oct 28, 2012 11:20 am
Contact:

Re: ex51.c doesn't work but lcd.hex does

Post by Dannny121212 »

You forgot> settings/target/...

Post Reply