Convert Library Issue

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
gramo
Registered User
Registered User
Posts: 200
Joined: Tue Mar 20, 2007 6:55 am
Location: Australia
Contact:

Convert Library Issue

Post by gramo » Wed Sep 26, 2007 12:55 pm

I've isolated a problem in a program down to the convert library;

Code: Select all

Device = 18F2620
Clock = 40

Config OSC = HSPLL

// some LCD options...
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.2
#option LCD_EN = PORTB.3

// import LCD library...
Include "LCD.bas" 
Include "convert.bas"

Dim Time As LongWord

// program start...
INTCON2.7 = 1                 // Turn off PORTB Pullups
ADCON1 = %00001111            // Make all I/O's digital
ADCON0.0 = 0                  //  

DelayMS(100)
Cls

Time = 90000    
LCD.WriteAt(1,1, DecToStr(Time))

While True
Wend
The above will not produce anything on the LCD, where as;

Code: Select all

Device = 18F2620
Clock = 40

Config OSC = HSPLL

// some LCD options...
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.2
#option LCD_EN = PORTB.3

// import LCD library...
Include "LCD.bas" 
Include "convert.bas"

// program start...
INTCON2.7 = 1                 // Turn off PORTB Pullups
ADCON1 = %00001111            // Make all I/O's digital
ADCON0.0 = 0                  //  

DelayMS(100)
Cls

LCD.WriteAt(1,1, DecToStr(242))

While True
Wend
will produce "242" as expected. Any thoughts?

Using Vr 2.0.1.0
Last edited by gramo on Sat Sep 29, 2007 12:14 am, edited 1 time in total.
digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.

Australian distributor for the Swordfish Compiler

yo2lio
Posts: 39
Joined: Tue Sep 25, 2007 6:52 pm
Location: Arad, Romania
Contact:

Post by yo2lio » Wed Sep 26, 2007 4:21 pm

At me works ! BigPic4 board, MCU PIC18F8722 and PIC18F8520

Code: Select all

Device = 18F8520
Clock = 40
Config OSC = HSPLL
 
// some LCD options...
#option LCD_DATA = PORTH.4
#option LCD_RS = PORTH.2
#option LCD_EN = PORTH.3

// import LCD library...
Include "LCD.bas" 
Include "convert.bas"

Dim count As LongWord 

ADCON0 = 0
CMCON  = $07                   // turn off comparators
ADCON1 = $0F                   // turn off analog inputs
MEMCON.7 = 1                // disable external memory bus
count = $FFFFFFF0
Cls
While true
  LCD.WriteAt(1,1, DecToStr(count))
  Inc(count)
  DelayMS(50)
Wend
Best regards, Florin Medrea
My UserLibrary Folder http://www.microelemente.ro/Swordfish/UserLibrary/

xor
Posts: 286
Joined: Sun Nov 05, 2006 1:15 pm
Location: NYC
Contact:

Post by xor » Wed Sep 26, 2007 7:09 pm

I tried your code on my '2550 and it worked fine.

Code: Select all

Device = 18F2550
Clock = 48

' set up config for 8MHz crystal and USB
Config USBDIV  = 2
Config CPUDIV  = OSC1_PLL2
Config PLLDIV  = 2
Config FOSC    = HSPLL_HS

// some LCD options...
#option LCD_DATA  = PORTB.4
#option LCD_RS    = PORTB.2
#option LCD_EN    = PORTB.3

// import LCD library...
Include "LCD.bas"
Include "convert.bas"

Dim Time As LongWord

// program start...
INTCON2.7 = 1                 // Turn off PORTB Pullups
ADCON1 = 14                   // Make all I/O's digital
ADCON0.0 = 0

DelayMS(100)
Cls

Time = 90000   
LCD.WriteAt(1,1, DecToStr(Time))

While True
Wend 
PortB pullups do not affect output pins, such as those used by the LCD, and may even be desirable for unconnected input pins. ADCON0.0=0 is not necessary when ADCON1=15 is used.

gramo
Registered User
Registered User
Posts: 200
Joined: Tue Mar 20, 2007 6:55 am
Location: Australia
Contact:

Post by gramo » Sat Sep 29, 2007 12:13 am

Well I have to admit I had no idea what was going on with that PIC. Never assumed it could have been it when other modules were working fine as I 'tested' them on it.

Whole program works fine on a different 18F2620
digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.

Australian distributor for the Swordfish Compiler

Post Reply