View previous topic :: View next topic |
Author |
Message |
thewiz
Joined: 29 Oct 2013 Posts: 2 Location: Hamilton, NZ
|
Posted: Fri May 15, 2020 6:31 am Post subject: Low(s) and High(s) functions |
|
|
Hi,
There is a feature of Bascom-8051 that does not seem to be in Bascom-AVR. I discovered this when altering code written for an P89C51RD2 to run on an ATmega2561. When I go to compile I get an Error: 46 Assignment error. The particular line(s) that causes this error is:
High(bework) = I2cbuf(1)
Low(bework) = I2cbuf(2)
In Bascom-8051 you could use Low(s) and High(s) as a function or statement but in Bascom-AVR you can only use it as a function.
Before I go ahead and rewrite all of the these instances (and there are a lot of them) with Rotate or Shift statements are there any equivalent statements in Bascom-AVR to "HIGH(word) = byte"?
Any help is appreciated
Mark Perry
(BASCOM-AVR version : 2.0.8.2 ) |
|
Back to top |
|
|
i.dobson
Joined: 05 Jan 2006 Posts: 1570 Location: Basel, Switzerland
|
Posted: Fri May 15, 2020 8:24 am Post subject: |
|
|
Hi,
Maybe you could use an overlay
Dim Value As Word
Dim Lo As Byte At Value Overlay
Dim Hi As Byte At Value + 1 Overlay
Note High and Low are functions in Bascom AVR (Z = High(i) works).
Regards
Ian Dobson _________________ Walking on water and writing software to specification is easy if they're frozen. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri May 15, 2020 9:31 am Post subject: |
|
|
While the AVR version is based on the 8051 version i had no idea that was missing.
you can create a sub like setLSB and setMSB and then pass the data. or indeed use overlay. but i think it will be simpler if i add this to bascom.
if you write to support i can make a beta available. (in some days) _________________ Mark |
|
Back to top |
|
|
thewiz
Joined: 29 Oct 2013 Posts: 2 Location: Hamilton, NZ
|
Posted: Mon May 18, 2020 9:18 pm Post subject: |
|
|
Thanks Ian, I shall have a play with the OVERLAY. Looking through the BASCOM-AVR help file ere are many features I have never looked at so I thought there would be another way to do this task easily.
I shall send a message to support, Mark, as I have a lot of code to change, the program is currently 7,400 lines long and the reason I am changing to an ATmega2561 is that I have run out of memory space in the 89C51RD2! Mind you, there are probably several optimizations that I could make that I didn't know about (or exist) when I originally wrote the software 15 years ago.
Mark P |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Tue May 19, 2020 12:44 am Post subject: |
|
|
Hello Mark P
Have you looked at the mega1284p it has advantages over other chips with 20mhz and 16k of ram.
Regards Paul |
|
Back to top |
|
|
|