Novice assembler programmer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Novice assembler programmer

1,243 Views
rail21
Contributor I

Hi folks and while I have been programming Motorola micros for about 10 years, I’m still a novice when it comes to writing programs.

 

I only write in Assembly language.

 

I’ve been working with QB8 chips for a few years and have no problems programming them for what I need, using CW6.3.

 

BUT, I needed a new micro for a project I am working on and purchased both some MC9S08SH8 micros and a USB BDM Multilink.

 

I have a program written for the QB8s but so far I have not been able to change the CPU setting to an MC9S08SH8 with out having loads of problems.

 

The main one is that each time I start a new program or change a existing program to use the MC9S08SH8, I continually get the A13003 coming up. This is the “Value is truncated to one Byte”

 

I have followed all the instructions given in the Warnings and Error files, all to no avail.

 

Is there any documentation that I can be pointed to to be able to sort out my problems and get a better education, form a novices point of view, for programming these micros using CW6.3

 

Regards, Tim.

Labels (1)
Tags (1)
0 Kudos
9 Replies

794 Views
rail21
Contributor I

Hi Jennie and thank you for your reply.

I have, for now, given up on CW10.

But I could not understand why I could program SH8 chips using CW6.3 but could not work with QG8 chips in CW6.3.

It took a while but i finally realised that each time I created a new project for the QG8 chips in CW6.3, I would uncheck the C and C++ but instead of checking RELOCATABLE ASSEMBLY, I was checking ABSOLUTE ASSEMBLY.

After rereading the manual and checking RELOCATABLE ASSEMBLY, I have now been busy transferring QB8 programs to QG8 chip.

I will try working with both Windows7 and CW10 at some later date.

As posted earlier, I am my own worst enemy.

0 Kudos

794 Views
rail21
Contributor I

Hi Erich and thank you for your quick reply.

As I pointed out in an earlier post, I am a novice at this type application.

Plus while I have used both PCs and Macs for for near 3 decades, but with the single exception of having to use Windows 7 or higher to use Eclipse, I have not touched Windows 7 or higher, so this just adds to my lack of knowledge of the application needed to program the QG8s.

I gave the whole idea of changing over to the new chips a miss back in 2012, as I run a small family business and there are only so many hours in the day.

But I make a number of RV ( Recreation Vehicle ) electronics based products and most are based around the QB8 chips, and as the QB8 chips have not been available for some time and I am down to my last thousand, so I just have no choice but to change over ASAP.

So as you can see, I am my own worst enemy because of my lack of knowledge in a number of areas.

I am also using SH8 chips and can program them using CW v6.3, but so far, I have not been able to find the appropriate files or what ever, to be able to program the QG8 chips using CW v6.3.

Kind regards, Tim.

0 Kudos

794 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Tim,

CW6.3 can work with GQ8 without problem.

but CW6.3 doesn't support 64bit system. So if you use 64bit win7, please use CW10.x instead.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

794 Views
rail21
Contributor I

Hi folks and believe it or not, but I am still not having much success understanding how to use CW v10.2.

I have not been at this for 7 years and while I gave up 7 years ago, I have spent the last 6 months trying to get a grip on this program.

I have managed to make a programming PCB and written and executed a very basic program, thanks to some YouTube videos.

But now, every time I try to start a new program, I either end up with the old one ( main ) or now, after spending hours converting a QB8 ASM file to a QG8 ASM file, which has now written itself over the original test ASM file.

Also, with CW v6.3, would have up to 5 or 6 different ASM files open at the same time.

Anytime I try to open another file, I keep getting the same “main” file.

Is there any way to program and use QG8 ASM in CW v6.3? This would save a lot of time and frustration.

0 Kudos

794 Views
BlackNight
NXP Employee
NXP Employee

Hi Tim,

I'm not sure if I understand what you are saying. But there is no problem on my end to have multiple asm files open and using with Eclipse (I'm using 10.7, but that should not matter).

I have not used 6.3 actively for several years, but as well in Classic CodeWarrior you can use any number of assembly files.

Other than that: you would have to provide more details?

Regards,

Erich

0 Kudos

794 Views
rail21
Contributor I

Hi Mac and Daniel and thank you for your relies.

 

I had tried a few of your suggestions but while going over some of the points you raised I discovered the fault was mine.

 

I have a laptop set up with a Multilink and rather than confuse the set up, I used a second laptop and loaded the CW6.3 software to run the BDM Multilink and any programs I might manage to write for the MC9S08SH8 micros.

 

Thanks to your info, I went looking for similarities in my old programs on the first laptop and noticed I was missing a number of files on the second laptop.

 

Being a novice, I had not loaded all the files needed when I created the new program on the second laptop.

 

Initially I had only copied the single file from one laptop to the other. After noticing the missing file, I copied all the files of one program from the first to the second laptop and simply changed the CPU selection.

 

All now seems to be working although I have not yet had time to program a chip to see if I have got it set up correctly.

 

I have been writing very basic programs since about the time the J1As came on the market but as you can see I am still well and truly a novice and as a novice, is there anywhere I can find basic programming info to help get an idea of how to advance my programming skills?

 

Once again, many thanks, as your replies definitely helped me find the error of MY ways.

 

Regards, Tim.

0 Kudos

794 Views
bigmac
Specialist III

Hello Tim, and welcome to the forum.

 

I take it that the MCU you have previously used is the MC908QB8, rather than the MC9S08QB8?  However, code written for the 908 device should still work for the later 9S08 devices (but not necessarily vice versa).  I might have expected that the A13003 warning message would have occurred whatever derivative had been selected for the specific code.  Of course, unless you had previously explicitly disabled this message.

 

This message will generally occur with those instructions that have a direct (zero page) addressing mode, but do not have an extended addressing mode, and it is unclear to the assembler whether the particular variable referenced is 8-bit or 16-bit.  E.g.  CLR var1 may potentially cause this warning if the size of var1 is ambiguous.

 

To avoid this warning, make sure that the size of each variable is explicitly defined, e.g. use directive DS.B rather than DS, or XREF.B rather than XREF, etc.

 

While the specific warning message can be disabled, I do not think that this is a good idea.  There may be instances where this warning will indicate a programming mistake, that needs to be corrected for proper operation of the code.

 

Did you use the new project wizard to create a new project for the MC9S08 device?  You can then copy the existing code to the new project.  There are likely to be significant differences, within your initialization code at least.

 

Regards,

Mac

 

0 Kudos

794 Views
CompilerGuru
NXP Employee
NXP Employee

The remark to add a .B suffix to mark zero page references is correct for XREF and XDEF.

For the DS command, which allocates space the meaning of the .B is different. E.g. "DS.B 2" allocates 2 bytes, a "DS.W 2" allocates 2 words, meaning 4 bytes. So don't change the DS directives for this.

 

Also with relocatable assembly, add a SHORT after the section keywork if that section is allocated in the first 0x100 bytes of memory.

XXX: SECTION SHORT

 

Daniel

0 Kudos

794 Views
bigmac
Specialist III

Hello,

 

I just checked out the assembler manual.  To explicitly reference a variable to a zero page location, the directive should be XREFB, rather than XREF or XREF.B.  Of course, this directive is applicable only to relocatable source code.

 

You did not say whether the existing project was using relocatable or absolute assembly code.

 

Regards,

Mac

 

0 Kudos