View previous topic :: View next topic |
Author |
Message |
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
Strange-18F4431 Problem. |
Posted: Tue Oct 21, 2014 11:39 pm |
|
|
Hi,
I have designed circuit for a display with the following code.
Code: |
#include <18F4431.h>
#device ICD=TRUE ADC=10
#fuses HS,NOLVP,NOWDT
#use delay (clock=8M)
#include <flex_lcd.c>
#include <stdlib.h>
void main()
{
lcd_init();
//delay_us(30);
delay_ms(100);
while(true)
{
lcd_putc("\fHello\n");
lcd_putc("\World\n");
delay_ms(1000);
output_toggle(Pin_B4);
}
}
|
which is not working, however when I change the header file to 18F4520.h and use 18F4520 it works on the same circuit board.
Not sure what is the problem.,
please suggest.
Sid |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Wed Oct 22, 2014 12:32 am |
|
|
The old comment applies.
If having problems, look at what peripherals are on the pins.
Now, you don't tell us what pins your LCD is on, but look at what the NOPWMPIN fuse does. |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
|
Posted: Wed Oct 22, 2014 12:50 am |
|
|
MuC Pin LCD Pin
Pin D0 -> E
Pin D1 -> RS
Pin D2 -> RW
Pin D4 -> LCD_D4
Pin D5 -> LCD_D5
Pin D6 -> LCD_D6
Pin D7 -> LCD_D7
I tried NOPWMPIN but still there is no change.. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Wed Oct 22, 2014 5:28 am |
|
|
I don't use those PICS but some
other things that need looking at...
1) icd=true. might affect operation,I don't use it but.......
2) HS. is it the correct option for your clock setup?
3) do a delay before the LCD_init. Every LCD module needs some 'waking up time' before you access it. Usually a delay_ms(500) is executed before the LCD_init() call.
4) as Mr. T says....check out what other peripherals are using those pins( or others !).
5) does the classic 1Hz LED test run correctly ?
hth
jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Wed Oct 22, 2014 8:43 am |
|
|
Try disabling BROWNOUT.
I remember having problems with these chips. Two things. The first was the NOPWMPIN, and the second was that it defaulted to having the brownout enabled, but the voltage set to 'reserved' (impossible combination...).
Agree whole heartedly with Temtronics other comments. Remember if ICD is set 'true', and you are not connected to an ICD unit, resistors are required on the ICD lines of the chip won't work... |
|
|
|