Watch content of Assembler "variables"

Go To Last Post
30 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hi Experts

As my Assembler debugging is up running now I have yet another question. 

I am using Atmel Studio version : 7.0.1645 and actually I expected, that it should be posible to watch the content of assembler variables in the watch window.  In my small test project I have 3 variables defines af shown below :

.dseg

.org SRAM_START

Timer0OverflowCounter: .BYTE 1

Timer0OverflowCounterStopValue:.Byte 1

PortBValue: .Byte 1 

When I add the 3 "variables" to the Watch Window, I can see the adress of the variables, but nt the content of the variables (see below) :

 

Assembler "variables" in Watch Window

As Atmel Studio has informations on the addresses of the "variables" it shouldn't be to complex a task to show the content of the "variables" in my opinion. 

Perhaps it is as simple as just prefixing or postfixing the variable name by some character ??? 

 

This topic has a solution.
Last Edited: Mon. Jan 8, 2018 - 02:02 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It does not know "everything". Note the assignment dword for variables given as bytes. The addresses, though, are certainly dword. And what is the ",x" in each name?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't remember anymore but this is an OLD bug, you have to put something else in the watch window as well as the variable name to display the value.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi ka7ehk

 

Thanks for the reply. 

 

Yes I am aware of the fact, that the adresses are dword, The ",x" is to see the address in hexadecimal notation. This way it is easier to look up the value manually in the Memory Window, if it isn't possible to see it in the watch window. Perhaps the figure below shows my point.  

 

In the figure it can be seen, that the variable Time0OverflowCounter has the value 0x01, the variable Time0OverflowCounterStopValue has the value 0xF5 and the variable PortBValue has the value 0x00.

 

As I stated before, it shouldn't be to hard a task to transfer the information from the memory window to the watch window. 

 

Assembler Variables Watch Window - Memory Window

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Js

 

Thanks for the reply.

 

I am quite new inside this forum, but I did see an older post with this subject discussed. But the version of Atmel Studio discussed in this post was version 5, as far as I remember, so I took the chance and hoped that Atmel Studio 7 might had a fix for this problem. 

 

I will search for the extra info to put beside my variable names in the watch window. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

smaldos you need to understand that "no one uses assembler anymore" or at least that's the mantra around here. wink So nothing will be done about this bug, from memory I may have been the first to report it with AS6??

 

If you can find my post then you may be able to find Atmel's workaround for this otherwise, as you know the address, look at the RAM location from the memory view.

 

The workaround may even be shown in the latest assembler docs but I'm too lazy to look it up and it's getting closer to 42C here and I need to water may garden or everything will die. cheeky

Don't worry about the chips, look after the potatoes.......

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

So I found the email + a little experimentation

 

 

you need to prefix the variable name with "BY" for byte, "WO" for word and "DW" for double word and then click on the little arrow when you halt the debugger.

 

WARNING" .dw defines a word in the assembler but "DW" defines a double word in the debugger.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Js

 

Great. And thanks you very much for the response and the effort you have put into findning the e-mail. It is much appreciated from my side. 

 

And as you stated in your previous post, I am aware that no one seems to use assembler anymore, due to the fact, that the C compilers have become more and more efficient. The reason why I am still using assembler is for educational purpose. I am teaching on a school in Denmark, where our students have to pass numerous programming courses in different programming languages. And we still find it worth the effort to let them have a course in pure Assembler proramming. Thereby giving them a better understanding on both HW and SW issues. 

 

As a new user on this forum I actually don't know, if there is some way I have to close this Post and provide you with some points for your splendid answer (I have just tested it and it works like a charm). So please let me know, if I have to perform an action for this to be fulfilled.  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

smaldos wrote:
As a new user on this forum I actually don't know, if there is some way I have to close this Post and provide you with some points for your splendid answer (I have just tested it and it works like a charm). So please let me know, if I have to perform an action for this to be fulfilled.  

Pick the post you think solved the problem. Beneath it there will be a button "Mark as solution" (or some such - only you can see that button). Click it and the thread will be marked as solved. Thank you!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am still using assembler is for educational purpose. I am teaching on a school in Denmark,

hohoh now you will be chastised for doing that, you will be vilified for being old fashioned and a Luddite, all that anyone needs is an Arduino etc. etc. devil

 

But as the song goes "You got a friend in me" along with many others that have to lurk in dark workshops for fear of the C people ostracizing and ridiculing them, their only defense uttering mnemonics and op-codes, some of them also wear garlic necklaces for protection. cheeky

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

smaldos wrote:
I am teaching on a school in Denmark, where our students have to pass numerous programming courses in ...

 

Asm still has it's place, especially in understanding the real low level stuff about uC architecture and compiler building.

However:

As you are a teacher I want to advise to look at Kate Gregory in "Stop Teaching C".

https://www.youtube.com/watch?v=...

 

It is  a long video (Just over 1 hour).

Kate is quite a smart girl who designs courses in programming and knows a lot about C++ and other programming langues.

In this video Kate talks to people who are teaching programming and gives a presentation about why a course in C++ should not start with C basics.

The video is based around ways of keeping students interested, and learning them a lot without getting boring/mundane and she explaines why C++ is perceived as a "difficult" language, and why this is mostly a myth based on "wrong" ways of teaching C++.

She adresses which parts to teach, and also explicitly which part not to teach (yet, in a beginnerscourse) and why she thinks about it that way.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Johan Ekdahl

 

Thanks for the info on how to mark a thread as solved. Only problem is that I can't find the button you are refering or any other button that could be used. Probably it is my lack of experience, when it comes to navigate in Forums thet becomes clear now. So unfortunately I am still kind of lost here.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi JS

 

I am quite happy to realize that I have an "assembler friend" now. I have worked with embedded development for almost 25 years and it my experience that certain tasks simply can't be done, or at least not done efficient enough withoue the use of assember language. Beside that the feeling of having full control and full knowledge on the Target is quite amazing.    

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Paulvdh

 

Great link you have provided. I have just seen 20 minutes of the video in the link you provided. And although our normal course content, after the asembler course is a pure C course, I will try to convience my colleagues, that we need to teach our students C++ already at this point. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

smaldos wrote:
Only problem is that I can't find the button you are refering or any other button that could be used

 

At the end of every post in a thread there is a row of buttons. For posts where you are the author the row should have buttons "Quote", "Edit", "Reply". Posts by others should have buttons "Quote", "Reply", "Mark Solution" and "Report".

 

It's the "Mark Solution" you want to use to mark the thread as solved.

 


 

The thread will still be open for new posts. There is no way for an ordinary user to close a thread in the meaning to lock it for future posts. Only moderators and administrators can do that, and it is only done by them where a thread is deemed to be derailed or when they are trying to stop a misbehaving poster to make additional posts etc.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
... For posts where you are the author the row should have buttons "Quote", "Edit", "Reply". Posts by others should have buttons "Quote", "Reply", "Mark Solution" and "Report".
Not here, only show Quote, Reply, and Report.  Add this to the broken forum features?

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Sat. Jan 6, 2018 - 11:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nice to have a new assembler person in this forum :) 

 

Where in Denmark do you teach ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
Posts by others should have buttons...
In threads I've started, the "Mark Solution" button also appears in my subsequent posts (just not the OP).

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Interesting". Here's an example of what I see:

 

 

The quality of this forum software/CMS is a joke. Atmel was robbed the last time. In their unfathomable wisdom they have decided to repeat the adventure. It calls for more facepalms than there's grains of sand in the Universe.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

frog_jr wrote:
In threads I've started...

 

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you look closely you'll see the OP started the thread from a different user/account.

Letting the smoke out since 1978

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

larryvc wrote:

frog_jr wrote:

In threads I've started...

 

 

Why the facepalm? (If OP finds the solution himself, and feeds back then he also should mark that feedback as the solution.)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

frog_jr wrote:
In threads I've started...
JohanEkdahl wrote:
Why the facepalm?
Remember this
larryvc wrote:
Not here, only show Quote, Reply, and Report.  Add this to the broken forum features?
Now do you understand blush  I wasn't in a thread I started.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Sun. Jan 7, 2018 - 08:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use a high language, as C or C++, to write PC programs only. I have no other way because I am not supposed to know all hardware details and protocols of my PC (or laptop) motherboard.

Only when I got my first microcomputer ZX spectrum (running on Z80 CPU) such knowledge was possible smiley

 

But since I have to design multi-function controller boards (usually for products needed by the local market) and use rather old MCUs (as AT89C2051 replaced lately by ATmega8), I used writing my codes in assembly only to take full advantage of whatever the MCU can provide in term of memory and speed.

 

I think if I can choose and buy any MCU and its appropriate tools (as all here can, I suppose), there would be no reason for me not to write its firmware using a high language.

By the way, my first code I wrote for Z80 CPU was in 'machine code'. Yes, I had to enter the code 'bit by bit' into SRAM ICs before transferring/saving all entered bytes in an EPROM. The code was for an out-door moving message panel (224 40W bulbs; 32 columns x 7 rows, driven by triacs). It took me about 2 months to fix all its bugs (I also have to enter the rather long message manually, bit by bit too). But when I got, early 80's, ZXspectrum and an assembler for Z80, programming became much easier.

 

Obviously, I enjoy now (at age 69) using the assembler and its debugger provided with AS6. Although I still need discovering my silly bugs by running my code on a separate breadboard (or on a prototype PCB if complex), finishing a program takes, in the average, a few hours only instead of months ;) But since I also use a third-party parallel programmer, I wrote a simple C program (for DOS by using BORLANDC 3.1 which I was able to buy decades ago) to add automatically the required fuses on the hex file generated by AS6.

 

I believe that every person knows what is best for him to do, in order to solve his various daily problems. So you never hear me 'arguing' with mature sane persons about what is right and wrong, what is good and bad or what is real and unreal :)

 

 

 

Last Edited: Sun. Jan 7, 2018 - 12:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi again Johan Ekdahl

 

Back again with the issue regarding being able to Mark the Solution. Problem is that I don't see the "Mark Solution" button on any of the posts in this thread. 

 

As a new user here I think I might have started the thread up in a wrong way. Is it possible ???

 

The only post where I have a fourth button, is in the initiel post in the thread (the one posted by myself as a starting point). Here I can see the button Unfollow as well. 

 

Buttons

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The forum software is very buggy. I can't explain why you can'tt see the "Mark solution" button and I definitively can not help getting it visible.

 

Having a marked solution is nice but it's no disaster if not. Just leave it as it is (and be happy you're not a Microchip (or former Atmel) stick holder..)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you have to use the correct login!

 

thread was made with an other login!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Sparrow2

 

YES !!!!!!!!!!!!!!!!!!

 

I can see it now. But as Johan Ekdahl wrote I also think there is a problem with the stability of the Forum SW. By accident i made 2 logins with different User Names but same E mails. So for both Logins I saw this thread as being made by my. That being the case has been the reason, why I didn't realize what seems obvious now.  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can shortcut this a little by putting the following into the watch window instead of "BY" var1 put (*BY var1)

this will remove the need for clicking on the blue arrow and will just display the value

 

If anyone knows the code to display a byte as bits I would like to know.

 

(I do all my coding in assembler)

 

Cheers

Murray

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kiwitechnics wrote:
If anyone knows the code to display a byte as bits I would like to know.
Surely hex is the same thing? I think all Asm programmers know all 16 bit patterns from 0 to F !