Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Propeller AN001 - Propeller Counters v1.0 Schematic font ? — Parallax Forums

Parallax Propeller AN001 - Propeller Counters v1.0 Schematic font ?

RamonRamon Posts: 484
edited 2007-08-05 16:59 in General Discussion
{{
This program demonstrates the use of the counter in POS detector with feedback to perform ADC
calculations using the following circuit:
3.3V

1nF 150kΩ
adcpin ─────┳──╋─────────── Analog In
100kΩ 1nF
fbpin ─────┘ 
Vss
The two capacitors and the 100kΩ resistor must be placed within 1" of the Propeller for stable
operation of the circuit and any excess leads must be cut away. This circuit will not work by
placing it on the Demoboard's breadboard.

The 150kΩ resistor may need slight adjustment of it's value in order to obtain as close to full
scale without clipping either end. This can be tested by tieing the Analog In to 3.3V and Vss and
noting the value produced, these values should be as near to 2^(sample bits)-1 (255 for bits=8)
and 0 without actually being either of these numbers (otherwise clipping occurs and a range of
voltages cannot be measured). These final numbers are used to compute what the full-on and
full-off (3.3V and 0V) values are.

Use of the circuit and program is sufficient for obtaining the voltage of a node between
0 and 3.3V. To obtain a current value, place a small ohm (<1&#937[noparse];)[/noparse] resistor (called a current sense
resistor) in the current path and use two ADC circuits to measure the voltage on both sides of
the resistor. Use Ohm's law to calculate the current flowing through the resistor.

The code shown below can be expanded to use both counters on the cog (CNTB in addition to the
CNTA as shown below) to better utilize each cog's resources. Doing this doubling up will yeild a
maximum of 16 ADC circuits, however 14 ADC circuits will be the highest practical implementation
since at least 1 cog will be needed to process the data.

}}
CON

_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000


' At 80MHz the ADC/DAC sample resolutions and rates are as follows:
'
' sample sample
' bits rate
'
' 5 2.5 MHz
' 6 1.25 MHz
' 7 625 KHz
' 8 313 KHz
' 9 156 KHz
' 10 78 KHz
' 11 39 KHz
' 12 19.5 KHz
' 13 9.77 KHz
' 14 4.88 KHz

bits = 12 'try different values from table here

'these are the pins used for the above circuit, rename these values to reassign the pins
'for best results use two pins which are not consecutive (ie not 0&1, 2&3 etc), since crosstalk
'can occur and cause fluctuations of the computed ADC value.
fbpin = 2
adcpin = 7

OBJ
txt1 : "VGA_Text"

VAR long value

PUB go
txt1.start(16)
cognew(@asm_entry, @value) 'launch assembly program into a COG
txt1.out($00)
repeat
waitcnt(40_000_000 + cnt)
txt1.out($00)
txt1.dec(value)


DAT

'
'
' Assembly program
'
org

asm_entry mov dira,asm_dira 'make pins 8 (ADC) and 0 (DAC) outputs

movs ctra,#adcpin 'POS W/FEEDBACK mode for CTRA
movd ctra,#fbpin
movi ctra,#%01001_000
mov frqa,#1

mov asm_cnt,cnt 'prepare for WAITCNT loop
add asm_cnt,asm_cycles


:loop waitcnt asm_cnt,asm_cycles 'wait for next CNT value (timing is determinant after WAITCNT)

mov asm_sample,phsa 'capture PHSA and get difference
sub asm_sample,asm_old
add asm_old,asm_sample

wrlong asm_sample, par

jmp #:loop 'wait for next sample period
'
'
' Data
'
asm_cycles long |< bits - 1 'sample time
asm_dira long |< fbpin 'output mask

asm_cnt res 1
asm_old res 1
asm_sample res 1

Comments

  • RamonRamon Posts: 484
    edited 2007-07-29 08:32
                             3.3V
                              &#61600;
                             &#61612;&#61613;&#61614;1nF  150k&#937; 
               adcpin &#9472;&#9472;&#9472;&#9472;&#9472;&#9523;&#9472;&#9472;&#9547;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#61629;&#61630;&#9472;&#9472;&#9472;&#9472; Analog In            
                      100k&#937;&#61628; &#61612;&#61613;&#61614;1nF
                fbpin &#9472;&#9472;&#9472;&#9472;&#9472;&#9496;  &#61602;
                             Vss   
    
    
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-07-30 17:28
    That is the Parallax Font designed for use in the Propeller tool. The forum's style sheet is not presently enabled to recognize the font so thats why it appears that way.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-08-01 05:46
    I did some experiments awhile back to see how the Parallax font might work in the forum pages. You can read about it here. Since the font doesn't scale well below 11 points, my results were mixed, and I don't know whether it would even be worth the trouble for Parallax to modify its stylesheet to accomodate this font. For displaying font schematics, it might be better just to take a screenshot from the Propeller IDE, crop it, and post it as a GIF.

    -Phil
  • RamonRamon Posts: 484
    edited 2007-08-05 16:59
    Hello,

    Thanks for the replys. I want to post same code to test NCO and DUTY Cycle mode on two LEDS.

    Here is my first post: http://forums.parallax.com/showthread.php?p=665823

    Best regards,
Sign In or Register to comment.