Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Problem with Byte Value reported on 64bit Windows10

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

Bascom Member



Joined: 06 Jan 2008
Posts: 38
Location: Hyderabad

india.gif
PostPosted: Sun Dec 16, 2018 4:50 pm    Post subject: Problem with Byte Value reported on 64bit Windows10 Reply with quote

Hello,

I have been a Bascom 8051 & Bascom AVR user for more than 10 years, Till recently was running BASCOM AVR on my 2009 MacBook Pro under Bootcamp 4.0 in Windows10 32 bit, had successfully updated my MacBook Pro to Windows10 under the Bootcamp 4.0 when it was available from Microsoft. For a fresh install it only supports Windows7 32 bit. I wanted to move to 64bit Windows10 as most of the software I use for Embedded circuit development now are only available for the 64bit os.

I had built an application, a Blood Centrifuge using ATMEGA32A, had actually finished the program on my earlier 32bit windows machine, i recompiled the firmware for the micro with just minor changes on the new Windows10 64bit machine. This started reporting the Byte values very funnily, Like the value "1" as 1000:,2 as 2000:, 3 as 4000:; 5 as 6000: and so on.

So I wrote a simple program where a byte value in a FOR Loop is displayed on the LCD, this again was producing the observed results, I then tried Integer and long values all with same junk, I then changed the variable to Float value this was displayed correctly. I also converted the Byte value to string and had that displayed, this again like the float displayed the correct byte value.


I then Included the LIB MCSBYTEINT.LIB, the problem is now gone, the byte & Integer values are reported correctly.

I was wondering if this has this something to do with the 64bit OS, can some one test the same and kindly update your observations, thanks in advance.

Regards

Madhav Tenneti

Code:


$Regfile="m32adef.dat"
$Crystal = 16000000
$Baud = 9600

$hwstack = 32
$swstack = 8
$framesize = 24

'$Lib "MCSBYTEint.lib"

Config LCD =20x4
Config LCDBus = 4
Config LCDPin = Pin, DB4 = PortC.4, DB5 = PortC.5, DB6 =  PortC.6, DB7 = PortC.7, E =  PortC.3, Rs =   PortC.2


Dim X as byte

Do
   For X = 1 to 10
      Cls
      LCD X
      wait 1
   Next
Loop
End
 


(BASCOM-AVR version : 2.0.8.1 )
Back to top
View user's profile Visit poster's website
Printpix52

Bascom Member



Joined: 18 Jun 2014
Posts: 223
Location: D.F.

mexico.gif
PostPosted: Mon Dec 17, 2018 1:12 am    Post subject: Reply with quote

HI Very Happy

Code:
$Regfile="m32adef.dat"
$Crystal = 16000000
$Baud = 9600
$hwstack = 32
$swstack = 8
$framesize = 24
$lib "MCSBYTEint.lib"
$sim

Config Lcdpin = Pin , E = Portc.1 , Rs = Portc.0
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3
Config Lcdpin = Pin , Db6 = Portc.4 , Db7 = Portc.5
Config Lcdbus = 4
Config Lcd = 16 * 2

Dim X As Byte

 Do
   For X = 1 to 10
      Cls
      LCD X
      wait 1
   Next
 Loop
 End
 
Back to top
View user's profile
madhav1080

Bascom Member



Joined: 06 Jan 2008
Posts: 38
Location: Hyderabad

india.gif
PostPosted: Mon Dec 17, 2018 6:27 am    Post subject: Problem with Byte Value reported on 64bit Windows10 Reply with quote

There is no problem when we run the Simulator.

I have programmed the Chip ATMEGA32A firmware that is when this problem surfaced, When it works ok on the simulator and fouls up on the actual device is what has bugged me, hence had made the request that some one, if can kindly find time to run this program on a Real chip from a Windows10 64bit Machine and report the results will be a great help. When running the same on a 32bit Windows10 platform running the current Bascom AVR there is no problem.

Earlier Had posted a problem pertaining to ATMEGA164PA timer2 issue, have had no response on this too, The same code works on ATMEGA32A with no problem with Timer2, again if some one can kindly test this too, will be a big help.

Appreciate your time & help

Madhav Tenneti
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 1813

blank.gif
PostPosted: Mon Dec 17, 2018 9:16 am    Post subject: Re: Problem with Byte Value reported on 64bit Windows10 Reply with quote

madhav1080 wrote:
Earlier Had posted a problem pertaining to ATMEGA164PA timer2 issue, have had no response on this too, The same code works on ATMEGA32A with no problem with Timer2, again if some one can kindly test this too, will be a big help.

Could it be because you did not show up with any sample code?
How do you expect that anyone takes the efforts to make YOUR problem his own, if you do not even show a minimum effort, which would be to provide a minimalistic code for the problem?

As it seems you can think only about your problem, you miss to see what others - potential helpsters - could motivate.
For example you could have provided a link to your earlier thread.
I'll help you in this case:
https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=14254

But still then, could it be that you have already unlearned the results from this thread?
https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&p=76068&highlight=#76068
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5061
Location: Holland

blank.gif
PostPosted: Mon Dec 17, 2018 10:34 am    Post subject: Reply with quote

Quote:
with just minor changes


that is not a real good approach when checking a problem.
first of all,(or second) it does not matter if you run on win7 or win10 and if it is 32 or 64 bit. (period)
simply said, your changes makes it work different, and that is not due win 10.

did you checked the hardware of your new PC? which programmer do you use, and did you verify the programming?
you should increase the $swstack
also, do a binary compare on the two files : file1 on your old pc and file 2 on your new pc

_________________
Mark
Back to top
View user's profile Visit poster's website
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2113

netherlands.gif
PostPosted: Mon Dec 17, 2018 9:41 pm    Post subject: Reply with quote

Are using the same Bascom version on both the windows versions?
Did you update the windows version or started over again? If you started over again are you sure that the ide settings are the same as in the old setup. ( Code optimization etc).
As mark already suggested try increasing you stack size.

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
madhav1080

Bascom Member



Joined: 06 Jan 2008
Posts: 38
Location: Hyderabad

india.gif
PostPosted: Wed Dec 19, 2018 6:31 am    Post subject: Reply with quote

albertsm wrote:
Quote:
with just minor changes


that is not a real good approach when checking a problem.
first of all,(or second) it does not matter if you run on win7 or win10 and if it is 32 or 64 bit. (period)
simply said, your changes makes it work different, and that is not due win 10.

did you checked the hardware of your new PC? which programmer do you use, and did you verify the programming?
you should increase the $swstack
also, do a binary compare on the two files : file1 on your old pc and file 2 on your new pc


Thanks for Reverting Back Promptly,

Well I use Two Programmers

1) ATMEL AVR ISP MK2
2) ATMEL ICE-BASIC

But during the test had used the ATMEL AVR ISP-MK2 for dumping the compiled firmware on both the Machines.

Actually for the code posted I Reduced the $Stack size from my actual program settings.

$hwstack = 256
$swstack = 128
$framesize = 156


Dear Mark,

My Question here is not about the OLD to NEW PC change, here it pertains to the code posted, when I compile this on the Windows Pro 10 64 Bit the LCD reports wrong Data. Unable to understand the reason....

1) Changed the variable from Byte to Integer (1 was displayed as 1000:, 2 was displayed as 2000:, 3 was displayed as 4000:)
2) Next to Long exactly x was displayed as that for Integer or that for byte
3) Finally to Single

This time the LCD Displayed the correct data as 1.0, 2.0, 3.0 etc for the for loop for X 1 to 10 as expected.
Then I Changed the Variable back to the Byte Type but now had used Lcd Str(X), I didnt include the McsByteInt.lib, even then the display correctly displayed 1, 2, 3 for the for loop for X 1 to 10.

I Then added the McsByteInt.lib as i was using the String Conversions, this change I made to my actual program (Blood Centrifuge) too and the Program Now Works fine even when compiled on 64 bit system.

Just to understand if the problem had anything to do with the 64bit OS I tested the original program with the Variable X displayed in For loop on the Client's Windows10 32 bit system which was available that day, No Problem was observed, (I programmed with the same programmer on the same hardware with the same micro and all BASCOM AVR Settings remaining the same)

I have observed that the BASCOM AVR is actually installed under the Program Files(X86) on the Windows10 Pro 64bit system (My Laptop). Was thinking there could be some issue with variable representation hence posted here.



Once again Thanking everyone for their inputs and time.

Madhav Tenneti
[/img]
Back to top
View user's profile Visit poster's website
madhav1080

Bascom Member



Joined: 06 Jan 2008
Posts: 38
Location: Hyderabad

india.gif
PostPosted: Wed Dec 19, 2018 7:09 am    Post subject: Reply with quote

Evert Smile wrote:
Are using the same Bascom version on both the windows versions?
Did you update the windows version or started over again? If you started over again are you sure that the ide settings are the same as in the old setup. ( Code optimization etc).
As mark already suggested try increasing you stack size.



Thanks for your Reply,

I had bought a new Laptop as I couldn't upgrade the Windows10 32 bit running on the bootcamp 4.0, The New laptop has by Default Windows10 Pro 64Bit. I did a clean install for all the software on the new machine. The Environment settings are exactly same on the New Laptop. I had put in my test code, here only for this code i reduced the $stack settings since Just a single variable is used, no subroutines, no interrupts etc.

As Suggested have increased the settings size, the ones i used in my actual program, attached the code here, still the same result, have attached the pic as displayed on the LCD for your kind reference.

However When I include the MCSBYTEINT.LIB the variable X is displayed as expected i.e 1, 2, 3 etc for x 1 to 10.

Code:

$Regfile="m32adef.dat"
$Crystal = 16000000
$Baud = 9600

$hwstack = 256
$swstack = 128
$framesize = 156

'$Lib "MCSBYTEint.lib"

Config LCD =20x4
Config LCDBus = 4
Config LCDPin = Pin, DB4 = PortC.4, DB5 = PortC.5, DB6 =  PortC.6, DB7 = PortC.7, E =  PortC.3, Rs =   PortC.2


Dim X as byte

Do
   For X = 1 to 10
      Cls
      LCD Str(X)
      wait 1
   Next
Loop
End
 


Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 1813

blank.gif
PostPosted: Wed Dec 19, 2018 9:26 am    Post subject: Reply with quote

First, kick out:
Code:
Config LCDBus = 4

Neither you connect the display in bus-mode, nor does the ATMega32a provide such an external memory interface.

If the '10000:_' still shows after recompile, post the resulting hex-file for download and I will have a look through it.

Also try out what happens, if you alter lcd-output like that:
Code:
LCD Str(X); "   "
Back to top
View user's profile
Printpix52

Bascom Member



Joined: 18 Jun 2014
Posts: 223
Location: D.F.

mexico.gif
PostPosted: Wed Dec 19, 2018 1:30 pm    Post subject: Reply with quote

In my PC window 10 pro 64 bit the size of $ Stack of the real configuration of my program are these and yours is high values.




madhav1080:

Code:
$hwstack = 256
$swstack = 128
$framesize = 156



 


Printpix52:


Code:
$hwstack = 40
$swstack = 16
$framesize = 32
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