PDA

View Full Version : DAC output/ Pin number selection? (Propeller)



Patrice
05-01-2008, 10:26 PM
Hi everyone,
·
- Using (well trying to use), cog counters to get analogue outputs, I cannot find·how to drive the APIN signal to any other pin than P0; lets say to P5 instead of P0.
For instance, in operation mode %00110 DUTY single ended ·(Code like the one in Parallax Application Note AN001/Propeller counters – Duty Cycle modes of operation p11-13)
·
Please, does anyone know how to do that, and even if it is possible?

- In fact six bits APIN and BPIN of CTRx register fields are quite·a mystery to me.
What difference between affecting APIN reg. = %X10000 or %X00001?
I first though it could mean Pin16 or Pin1, but it does not seem so.
Maybe I missed something in the manual or did not the right thing with DIRA.
·
Thank you for helping.

Mike Green
05-01-2008, 11:45 PM
APIN and BPIN specify the output pin to be used for the counter. The various counter modes use one or two I/O pins. APIN is the primary pin to be used. BPIN is the (optional) secondary pin to be used. The number in the 6 bit field is the pin number. Pins from 32 to 63 do not exist in the current Propeller chip. An APIN value of %010000 specifies I/O pin 16 while a value of %000001 specifies I/O pin 1. You also have to set the corresponding DIRA bit to a one. If you don't set the DIRA bit, the counter output is "or"d with the OUTA register value and made available to the output circuitry, but the output driver transistors are disabled (they're enabled by the DIRA bit).

Paul Baker
05-01-2008, 11:49 PM
Hi, Patrice I see you've read AN001. Can you provide the code you are using to set CTRA? You have to make sure if you are setting fields in different instructions that you preserve the current contents. Figuring out whats going on in your code will be easier if you can post the snippet which sets up the counter.

The reason there are 6 bits is that there are plans for 64 I/O devices, so that 6th bit is <reserved>. AN001 makes a brief mention about this on page 2.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker (mailto:pbaker@parallax.com)
Propeller Applications Engineer
[/url][url=http://www.parallax.com] (http://www.parallax.com)
Parallax, Inc. (http://www.parallax.com)

Patrice
05-05-2008, 03:06 PM
Paul, Mike,

I could not make another try again before this morning,·now I think I should apologize for disturbing because it is Ok.
Cumulated mistakes and number of "0" that was probably wrong in fact...
Thank you very much
·

Paul Baker
05-06-2008, 03:50 AM
No problem, glad you got it working.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker (mailto:pbaker@parallax.com)
Propeller Applications Engineer
[/url][url=http://www.parallax.com] (http://www.parallax.com)
Parallax, Inc. (http://www.parallax.com)