ATN woes
ATN woes
As Emily Latilla said, never mind.
I needed to update the VM (an Emergency Update on one of the machines) on another project socket. Now, while digging through the docs to convert BX-24 code to ZBasic, I find I didn't read the documentation far enough. The app uses three PWMs. Bummer.
Back to the BX-24p.
Tom
I needed to update the VM (an Emergency Update on one of the machines) on another project socket. Now, while digging through the docs to convert BX-24 code to ZBasic, I find I didn't read the documentation far enough. The app uses three PWMs. Bummer.
Back to the BX-24p.
Tom
Tom
Re: ATN woes
Your application is using 3 PWM channels on the BX-24P? It has been a while since I used the BX, but I was not aware that it had more hardware PWM capabilities than the ZX.GTBecker wrote:The app uses three PWMs. Bummer. Back to the BX-24p.
Tom
The ATMega8535 on the BX24P has one 16 bit timer and two 8 bit timers. So, It does not have more basic hardware PWM support than the ATMega32 or 644.
It has been a year since I messed with PWM on the ZX, but I think it is possible to get 2 channels of PWM on the 16-bit timer, and you can still access one of the 8-bit timers for another 2 channels.
Off the top of my head, I would have thought that you could get 4 PWM channels on the ZX if you had limited needs for other timer-based operations.
My impression was that the ZX platform was at least the equal of the BX in PWM support. I guess I am wrong!
-Tony
Re: ATN woes
> ... Your application is using 3 PWM channels on the BX-24P? It has been a while since I used the BX, but I was not aware that it had more hardware PWM capabilities than the ZX.
Yes, two motors and an IR source. I, too, have not read of any BX-24 capability that the ZX processors lack, but here it is, I guess. It appears that Timer2 is used for other internals in the ZX-24 processors.
Don?
Tom
Yes, two motors and an IR source. I, too, have not read of any BX-24 capability that the ZX processors lack, but here it is, I guess. It appears that Timer2 is used for other internals in the ZX-24 processors.
Don?
Tom
Tom
The ZX-24 has 3 PWM channels as well. You can use the two PWM channels on Timer 1 and you can use Timer 2 as a 8-bit PWM if you don't use logical serial ports.
This page explains the resource allocations of the chip: http://www.zbasic.net/doc/ZBasicSysLib/ ... Lib17.html
This page explains the resource allocations of the chip: http://www.zbasic.net/doc/ZBasicSysLib/ ... Lib17.html
Mike Perks
ATN woes
> ... you can use Timer 2 as a 8-bit PWM if you don't use logical
serial ports.
Thanks, Mike. Then, unless I missed it, the documentation needs some
work, or OpenPWM(), ClosePWM() and PWM() should accept a third ZX-24 PWM
channel. And there's this: Error: reference to undefined identifier
"Register.TCCR2". How can I load that control register?
Tom
serial ports.
Thanks, Mike. Then, unless I missed it, the documentation needs some
work, or OpenPWM(), ClosePWM() and PWM() should accept a third ZX-24 PWM
channel. And there's this: Error: reference to undefined identifier
"Register.TCCR2". How can I load that control register?
Tom
Tom
Re: ATN woes
I think Don elected not to provide the third PWM port because by default Timer2 is assigned to logical COM ports.GTBecker wrote:> ... you can use Timer 2 as a 8-bit PWM if you don't use logical
serial ports.
Thanks, Mike. Then, unless I missed it, the documentation needs some
work, or OpenPWM(), ClosePWM() and PWM() should accept a third ZX-24 PWM
channel. And there's this: Error: reference to undefined identifier
"Register.TCCR2". How can I load that control register?
Tom
The error you are getting is because you have the wrong CPU setting; either in your project file, the source code or the device pulldown in the IDE. The easiest fix is to add the following line to your source code:
Code: Select all
Option TargetCPU ZX24
Mike Perks
ATN woes
> ... The error you are getting is because you have the wrong CPU
setting; either in your project file, the source code or the device
pulldown in the IDE. The easiest fix is to add the following line to
your source code:
Option TargetDevice ZX24a
which still does not like TCCR2. ZX24, the wrong machine, allows
TCCR2. That seems like a bug.
Thanks, Mike.
Tom
setting; either in your project file, the source code or the device
pulldown in the IDE. The easiest fix is to add the following line to
your source code:
You're right. Actually, I have the correct processor Option:*Code:*
Option TargetCPU ZX24
Option TargetDevice ZX24a
which still does not like TCCR2. ZX24, the wrong machine, allows
TCCR2. That seems like a bug.
Thanks, Mike.
Tom
Tom
Re: ATN woes
On a Mega644 there are two control registers for Timer2 called TCCR2A and TCCR2B. This is needed because they added a second timer output (OC2B on D.6) which needs additional control bits. There is also a second output compare register called OCR2B. The compiler is correctly complaining that it doesn't understand register TCCR2 on the ZX "a" devices.GTBecker wrote: Option TargetDevice ZX24a
which still does not like TCCR2. ZX24, the wrong machine, allows
TCCR2. That seems like a bug.
Here is the ATMega644 reference http://oakmicros.com/content/downloads/ ... atasheets/ . Yeah I know it's my website but all the manuals are in one nice place and I need the hits
Mike Perks
[Much later:] I found a root problem. I use a processor pin to control some external logic that switches ATN and RX between tether and wireless. All processor I/O floats during reset, including during the ATN-test period, which essentially disconnected those lines from the processor until the pin is initialized when my code started.
The solution is a pulldown on the pin, or I need to invert that pin logic if it reliably floats high, which seems the case.
The solution is a pulldown on the pin, or I need to invert that pin logic if it reliably floats high, which seems the case.
Tom
Re: ATN woes
The primary reason for not including the software UART timer (e.g. Timer2) is because it only has 8-bit resolution and the calculations required for it are significantly different than for 16-bit timers. If the additional PWM channel is needed, the code in the PWM application note that Tony wrote can be used (possibly with some modifications).mikep wrote:I think Don elected not to provide the third PWM port because by default Timer2 is assigned to logical COM ports.
- Don Kinzer