SH8 problem.

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

SH8 problem.

2,239 Views
derekjones
Contributor I

I am having troubles with PWM on the HCS08SH8. I have a simple program to control the brightness of an led. I wrote it a couple of months ago using a QD4 demo board. When all was working as I wanted it to, I loaded the program on to an HCS08QG8 where it worked fine. Needing another couple of I/O's, I decided to switch to the HCS08SH8 device. On this device the program fails in a strange way. When the modulation reaches about 50%, the waveform collapses to a spike, only to recover again at about 55%. What is going on? The program works fine on the other two devices.

Hope someone can shed some light on this problem.

Best regards,

Derek Jones.

0 Kudos
Reply
6 Replies

2,088 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Hi  

Do you have any scope of the problem?

can you please give me more information about the problem 

Thanks

0 Kudos
Reply

2,088 Views
derekjones
Contributor I

I have attached a copy of the code which worked perfectly on the QD4 and the QG8.

I monitored the waveform on an oscilloscope and watched the pulse widen as I altered the potentiometer. When the pulse was about 50% of the duty cycle, it collapsed into a pulse of about 5% wide. But as I increased the pot., the pulse reappeared at about 55% and grew as I continued to increase the pot.

The only difference I can find between the QD/QG devices and the SH is that the SH runs at twice the speed, and the SH has a different revision of TPM module.

I hope this helps to resolve this problem as I like to use the SH in many of my projects.

Best regards,

Derek Jones.

0 Kudos
Reply

2,088 Views
derekjones
Contributor I

Many thanks for spotting that; I wonder why CodeWarrior did not pick that up. The program now works correctly.

Whilst I have your attention I wonder if you could enlighten me as to what the difference is between RAMStart and Z_RAMStart? Other than several location in memory.

Best regards,

Derek.

0 Kudos
Reply

2,088 Views
tonyp
Senior Contributor II

Although I don't use CW (but my own ASM8 HC08/9S08 Assembler), and I'm not too sure about their naming conventions, I can safely guess by the name that Z_RAMStart is the beginning of zero-page RAM, i.e., RAM whose most significant byte is zero.  For the SH8, that would be between $80 and $FF.

Zero-page RAM is normally used for variables (e.g., bit-mapped flags) that need to be accessed with B[R]SET/B[R]CLR instructions and, in general, for any variables that are referenced the most number of times in your code as this results in smaller object size with zero-page operand instructions being one byte smaller.

Glad it worked!

0 Kudos
Reply

2,088 Views
derekjones
Contributor I

Your guess is correct. I checked the three devices I normally use and they all had RAMStart pointing at $100; above the immediate address range.

Many thanks for your help.

Regards,

Derek.

0 Kudos
Reply

2,088 Views
tonyp
Senior Contributor II

For one thing, there is no RAM at $60 for the SH8.  You need to relocate your variable (anval) elsewhere.

0 Kudos
Reply