Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Oshonsoft users?

Status
Not open for further replies.
hi eric, just tried out jim1 code...

syntax error on line 90...


If vref1 > 757 Or vref1 = 757 Then
vref1 = 200
Goto show2
Endif


i can't see the problem and have tried moving that around but that top line keeps failing...
 
hi eric, just tried out jim1 code...

syntax error on line 90...

If vref1 > 757 Or vref1 = 757 Then
vref1 = 200
Goto show2
Endif

i can't see the problem and have tried moving that around but that top line keeps failing...

hi Jim,
Just retried that jim1 and jim2 both compile OK.??
Can you post back the jim1.bas that you downloaded so I can check for corruption in up/downloading

You could try splitting the If vref1 > 757 Or vref1 = 757 Then into two tests

say,
If vref1 > 757 then
vref1=200
goto show2
endif

If vref1 = 757 then
vref1=200
goto show2
endif

Regards
 
hi Jim,
Just retried that jim1 and jim2 both compile OK.??
Can you post back the jim1.bas that you downloaded so I can check for corruption in up/downloading

You could try splitting the If vref1 > 757 Or vref1 = 757 Then into two tests

say,
If vref1 > 757 then
vref1=200
goto show2
endif

If vref1 = 757 then
vref1=200
goto show2
endif

Regards

i tried that last night with no luck... maybe some sort of bug in the software?
 
jim 1

Define SIMULATION_WAITMS_VALUE = 1 'make this =0 for programming a PIC

Define ADC_CLOCK = 3 'default value is 3
Define ADC_SAMPLEUS = 10 'default value is 20
Define LCD_BITS = 8 'allowed values are 4 and 8 - the number of data interface lines
Define LCD_DREG = PORTD
Define LCD_DBIT = 0 '0 or 4 for 4-bit interface, ignored for 8-bit interface
Define LCD_RSREG = PORTC
Define LCD_RSBIT = 0
Define LCD_EREG = PORTC
Define LCD_EBIT = 1
Define LCD_RWREG = 0 'set to 0 if not used, 0 is default
Define LCD_RWBIT = 0 'set to 0 if not used, 0 is default
Define LCD_COMMANDUS = 100 'delay after LCDCMDOUT, default value is 5000
'Define LCD_DATAUS = 10 'delay after LCDOUT, default value is 50
'Define LCD_INITMS = 1 'delay used by LCDINIT, default value is 100
'the last three Define directives set the values suitable for simulation; they should be omitted for a real device
'------------------------------------
'setup temp variables
Dim abc4 As Byte
Dim abc3 As Byte
Dim abc2 As Byte
Dim abc1 As Byte
Dim abc0 As Byte


Dim temp3 As Word
Dim binval As Word

Dim val0 As Word
Dim vref1 As Word '+++++++++++++++

'ADCON0 = %01000001 'adcchan0
'ADCON1 = %10001011 'Dis clk div,,,an0 > an3 analaog rest dig

TRISA = %00000001
TRISB = %11111111 'all inputs on portb
TRISC = %11111100


'-----------------------------------------------------

Lcdinit
Lcddefchar 0, 31, 31, 31, 31, 31, 31, 31, 31
Lcddefchar 1, %00011111, %00011111, %00011111, %00011111, %00011111, %00011111, %00011111, %00011111
Lcdout 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Lcdcmdout LcdLine2Home
Lcdout 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

WaitMs 1000

Lcdcmdout LcdHome
Lcdout "**Initialising**"
Lcdcmdout LcdLine2Home
Lcdout "*****FLIPS******"
WaitMs 750
Lcdcmdout LcdHome
Lcdout " PLEASE "
Lcdcmdout LcdLine2Home
Lcdout " WAIT "
WaitMs 750

main0:
Lcdcmdout LcdClear

main:
Gosub readadc
Goto main

End

'scale the 5V input to 4.88v using a resistive divider
readadc:
'read adc word
Adcin 0, val0
vref1 = val0 '+++++++++++++++++ make a copy

binval = val0 'rename for the bin2asc subr
Gosub bin2asc

Lcdcmdout LcdHome
Lcdout "Percent: ", abc3, abc2, abc1, ".", abc0, "%"

If vref1 < 102 Then
vref1 = 0
Goto show2
Endif


If vref1 > 757 Or vref1 = 757 Then
vref1 = 200
Goto show2
Endif

vref1 = vref1 - 102
vref1 = vref1 * 80
vref1 = vref1 / 262

show2:
binval = vref1
Gosub bin2asc
Lcdcmdout LcdLine2Home
Lcdout "Volume:", abc2, abc1, ".", abc0, "L"



Return

bin2asc:
'abc4 = binval / 10000' add these 4 lines for 16 bit conv
'temp3 = binval Mod 10000

'abc3 = temp3 / 1000
'temp3 = binval Mod 1000

abc3 = binval / 1000 'delete for 16 bit conv
temp3 = binval Mod 1000 'delete for 16 bit

abc2 = temp3 / 100
temp3 = temp3 Mod 100

abc1 = temp3 / 10
abc0 = temp3 Mod 10

abc4 = abc4 Or 0x30
abc3 = abc3 Or 0x30
abc2 = abc2 Or 0x30
abc1 = abc1 Or 0x30
abc0 = abc0 Or 0x30
WaitMs 250


Return





jim 2:


'04 Feb 2010 Forum

Define LCD_BITS = 4
Define LCD_DREG = PORTB
Define LCD_DBIT = 4

Define LCD_RSREG = PORTB
Define LCD_RSBIT = 3
Define LCD_EREG = PORTB
Define LCD_EBIT = 2
Define LCD_RSREG = PORTB
Define LCD_RWBIT = 1
Define LCD_LINES = 2
Define LCD_CHARS = 16


Define SIMULATION_WAITMS_VALUE = 1 'make this =0 for programming a PIC
'------------------------------------
'setup temp variables
Dim ascbfr4 As Byte
Dim ascbfr3 As Byte
Dim ascbfr2 As Byte
Dim ascbfr1 As Byte
Dim ascbfr0 As Byte

Dim temp3 As Word
Dim binval As Word

Dim volt0 As Word
Dim vref1 As Word

Dim intrcnt As Byte
Dim adcavg1 As Word

'''''''''''''''''''
T1CON.T1OSCEN = 1
T1CON.TMR1CS = 0
T1CON.TMR1ON = 1
T1CON.T1CKPS0 = 1 'tmr1 prescaler /256 gives a 8 microsec clock period
T1CON.T1CKPS1 = 1

TMR1H = 0xfe ''0xcf 'FFFF - CF2C = 30D3 == 12500 * 8 = ~ 0.1 sec/intr
TMR1L = 0xfe ''0x2c

INTCON.GIE = 1
INTCON.PEIE = 1

PIE1.TMR1IE = 1
PIR1.TMR1IF = 0
'''''''''''''''''''''''''''''''

ADCON0 = %01000001 'fosc/8
ADCON1 = %10000100 'Dis clk div,,,an0 > an3 analaog rest dig

TRISA = %00001111
TRISB = %00000001 'reserve portb.0 for ext interrupts, if required
TRISC = %11111111
'-----------------------------------------------------

Lcdinit
Enable 'enable interrupts

main0:
Lcdcmdout LcdClear

main: 'loop

If intrcnt > 4 Then
intrcnt = 0

binval = adcavg1 / 5 'rename for the bin2asc subr
vref1 = binval 'make a copy
adcavg1 = 0

Gosub bin2asc
'show average of 5 as percentage
Lcdcmdout LcdLine1Home
Lcdout "Percent: ", ascbfr3, ascbfr2, ascbfr1, ".", ascbfr0, "%"

If vref1 < 102 Then
vref1 = 0
Goto show2
Endif

If vref1 > 757 Or vref1 = 757 Then
vref1 = 200
Goto show2
Endif

vref1 = vref1 - 102
vref1 = vref1 * 80
vref1 = vref1 / 262

show2:
binval = vref1
Gosub bin2asc
Lcdcmdout LcdLine2Home
Lcdout "Volume:", ascbfr2, ascbfr1, ".", ascbfr0, "L"

Endif

Goto main

End
On Interrupt
Save System

PIR1.TMR1IF = 0

TMR1H = 0xfd ''0xcf
TMR1L = 0xfd ''0x2c

intrcnt = intrcnt + 1

Gosub readadc

adcavg1 = adcavg1 + volt0

Resume

'scale the 5V input to 4.88v using a resistive divider
readadc:
'read adc word
Adcin 0, volt0
Return



'you can convert any binary value from 0000h to fffFh to 0000 to 65535 decimal
'just name the binary word as binval and call this subr and the ASCII
'result will be in ascbfr4,3,2,1,0, ready for your LCD or UART
'just pop the DP in the output to the LCD [as shown above]

bin2asc:
'ascbfr4 = binval / 10000 'add these 4 lines for 16 bit conv
'temp3 = binval Mod 10000
'ascbfr3 = temp3 / 1000
'temp3 = binval Mod 1000

ascbfr3 = binval / 1000 'delete for 16 bit conv
temp3 = binval Mod 1000 'delete for 16 bit

ascbfr2 = temp3 / 100
temp3 = temp3 Mod 100

ascbfr1 = temp3 / 10
ascbfr0 = temp3 Mod 10
'results are BCD so
'convert to ASCII for LCD or UART
ascbfr4 = ascbfr4 Or 0x30
ascbfr3 = ascbfr3 Or 0x30
ascbfr2 = ascbfr2 Or 0x30
ascbfr1 = ascbfr1 Or 0x30
ascbfr0 = ascbfr0 Or 0x30
Return
 
Last edited:
hi Jim.
Retried both versions, no problems.

Which version of Oshonsoft are you using.??

I would suggest Remove the Oshonsoft program and re install it.

I have attached the jimredo2.txt, rename to jimredo2.HEX and use the File/load menu on the IDE

Here is an image of the jim2.bas running.



AAesp03.gif
 

Attachments

  • jimredo2.txt
    3.5 KB · Views: 464
Last edited:
hi Jim.
Retried both versions, no problems.

Which version of Oshonsoft are you using.??

I would suggest Remove the Oshonsoft program and re install it.

I have attached the jimredo2.txt, rename to jimredo2.HEX and use the File/load menu on the IDE

Here is an image of the jim2.bas running.



View attachment 38830

thanks... just off to the pub to watch the rugby (mid afternoon drinking is the beginning of a long downhill spiral i fear :-( but will uninstall and try again later...

i am using the sample evaluation version (and only have 4 hours left :mad:)
 
right, big problem... the new evaluation copy will only allow me to compile 50 lines of code... so i have to reuse version 5.22 which will not compile that code for some bizarre reason...
 
right, big problem... the new evaluation copy will only allow me to compile 50 lines of code... so i have to reuse version 5.22 which will not compile that code for some bizarre reason...

hi Jim,
My Registered version is 6.73 from last year.

I didn't realise you were using a evaluation version.

What do you plan to do.?:)

When you get the Registered version, you should get a short *.reg file for the Registry.
 
Last edited:
hi Jim,
My Registered version is 6.73 from last year.

I didn't realise you were using a evaluation version.

What do you plan to do.?:)

When you get the Registered version, you should get a short *.reg file for the Registry.

i don't know... still can't see why it wont compile in 5.22 though... that command looks fine...
 
i don't know... still can't see why it wont compile in 5.22 though... that command looks fine...

hi jim

In the IDE Help menu there a bug report option, why not send a report to Vladimir Soso asking for an answer.?

Where are you located.?
 
Last edited:
Hi eric...

is there any chance that if i write the basic in notepad that you could check it works and compile the hex for me and list it on here?

i know it may be asking a lot but you would be getting me out of a big hole because i only have until Wednesday to get this all going and i still have to finish building the hardware...

the ever-grateful jimbob...
 
Hi eric...

is there any chance that if i write the basic in notepad that you could check it works and compile the hex for me and list it on here?

i know it may be asking a lot but you would be getting me out of a big hole because i only have until Wednesday to get this all going and i still have to finish building the hardware...

the ever-grateful jimbob...

hi Jim,
Drop me a PM, send me your email address, it will be quicker.:)
 
hi eric...

have just spotted some problems in the pictures you sent me...

my intended range is:

0.5V = 0L = 0%
3.71V = 20L = 100%

the ranges in those pictures are...

0.5V = 0L = 10%
3.71 = 19.9L = 75.5%

seems like the Litres works fine but not the percentage... if it is a tricky one to solve feel free just to remove the percentage line from the LCD....

will still test to see if all else works on my hardware tomorrow, im due some luck this week so fingers crossed...

Thanks
Jim
 
hi eric...

have just spotted some problems in the pictures you sent me...

my intended range is:

0.5V = 0L = 0%
3.71V = 20L = 100%

the ranges in those pictures are...

0.5V = 0L = 10%
3.71 = 19.9L = 75.5%

seems like the Litres works fine but not the percentage... if it is a tricky one to solve feel free just to remove the percentage line from the LCD....

will still test to see if all else works on my hardware tomorrow, im due some luck this week so fingers crossed...

Thanks
Jim

hi,
I was under the impression you wanted the Percentage to relate to 0V =0% and 5V =100% and the

Volume to relate to 0.5V= 0vol and 3.71V = 20vol.

Changing the scaling to give you:

0.5V = 0L = 0%
3.71V = 20L = 100%


Its a simple matter to change it, I'll run thru it today.:)
 
hi,
I was under the impression you wanted the Percentage to relate to 0V =0% and 5V =100% and the

Volume to relate to 0.5V= 0vol and 3.71V = 20vol.

Changing the scaling to give you:

0.5V = 0L = 0%
3.71V = 20L = 100%


Its a simple matter to change it, I'll run thru it today.:)

thank you... you are a ray of sunshine on an otherwise cloudy day :)

jim
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top