Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Low(s) and High(s) functions

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
thewiz

Bascom Member



Joined: 29 Oct 2013
Posts: 2
Location: Hamilton, NZ

newzealand.gif
PostPosted: Fri May 15, 2020 6:31 am    Post subject: Low(s) and High(s) functions Reply with quote

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 Smile

Mark Perry

(BASCOM-AVR version : 2.0.8.2 )
Back to top
View user's profile Visit poster's website
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1534
Location: Basel, Switzerland

switzerland.gif
PostPosted: Fri May 15, 2020 8:24 am    Post subject: Reply with quote

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

_________________
Home of AVRTimer, the Bascom timer value calculator.
http://www.planet-ian.com

Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5077
Location: Holland

blank.gif
PostPosted: Fri May 15, 2020 9:31 am    Post subject: Reply with quote

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
View user's profile Visit poster's website
thewiz

Bascom Member



Joined: 29 Oct 2013
Posts: 2
Location: Hamilton, NZ

newzealand.gif
PostPosted: Mon May 18, 2020 9:18 pm    Post subject: Reply with quote

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
View user's profile Visit poster's website
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1198
Location: SYDNEY

australia.gif
PostPosted: Tue May 19, 2020 12:44 am    Post subject: Reply with quote

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
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum