PDA

View Full Version : Help! use PBP246 for PIC18F2525



dragon
- 19th December 2007, 06:16
We have tried to transfer from PIC16F to PIC18F2525. When we evaluated the PIC2525 with code to diaplay something in LCD,we failed:
coded in PICBasic ;
compiled using PBP246+MPLab V8;
The machine code did not work, there is nothing in LCD, but if we programm in ASM directly,it works.
And, if we embeded ASM lines into PicBasic lines,it didn't work either!


We have studied the PBP246 & PIC18F2525 for a long time,but no advance.
Anyone faced this kind of question too before?
Any advice is welcome!

dragon
- 19th December 2007, 08:07
Anyone use pbp246 over PIC2525 ?

skimask
- 19th December 2007, 15:34
Anyone use pbp246 over PIC2525 ?

Code used in PBP?

mister_e
- 19th December 2007, 16:19
For what i remind, PBP2.46 & PIC18F2525 worked for me. As Skimask says, just post your code here.

ronjodu
- 19th December 2007, 21:19
I know for a fact it works as I have a display board with 3 MAX6957's burning away right now with an 18f2525@ 20Mhz. I migrated from a 16f876 and had a few setup issues with registers but it went reasonably well.

Hope this helps..

dragon
- 22nd December 2007, 03:30
Thanks,try once more, if failed I will post the test code.

dragon
- 23rd December 2007, 02:36
DEFINE OSC 8
DEFINE LCD_DREG PORTA

DEFINE LCD_DBIT 0
DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 4
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 4000
DEFINE LCD_DATAUS 100

CMCON = 7
ADCON1 = 6
TRISA = %11000000


PAUSE 5000

loop:
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 1000 ' Wait .5 second

Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 1000 ' Wait .5 second


Goto loop ' Do it forever


End

dragon
- 23rd December 2007, 02:47
it doesn't work! please help! thanks




DEFINE OSC 8
DEFINE LCD_DREG PORTA

DEFINE LCD_DBIT 0
DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 4
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 4000
DEFINE LCD_DATAUS 100

CMCON = 7
ADCON1 = 6
TRISA = %11000000


PAUSE 5000

loop:
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 1000 ' Wait .5 second

Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 1000 ' Wait .5 second


Goto loop ' Do it forever


End

skimask
- 23rd December 2007, 02:58
We have studied the PBP246 & PIC18F2525 for a long time,but no advance.

Then study more you must...
In your case...

Port A, Bit 0-3 = data bits for LCD
Port A, bit 4 = e for LCD
Port A, bit 5 = rs for LCD

ADCON1 = 6
According to the datasheet I've got...
You've set up: ADCON1 = %0000110
Vref+/Vref- on Vdd/Vss...
AN9-AN12 = digital, AN8-AN0 = analog...

Do ya see any important information up there?

Page 224 of Microchip datasheet DS39626D...

dragon
- 26th December 2007, 00:58
CMCON should be defined correct value.

dragon
- 26th December 2007, 02:13
Skimask,Thank you very much for kindly explaination.