ZappBots wishes a warm welcome to everyone.

Especially our visitors from
Savage///Circuits and Parallax!!!


Please take a look our new forums, we hope you register and become an active user.

The ZappBots forums are being run on phpBB 3.1.4 software which is different then the vBulletin used on the Savage///Circuits and Parallax forums.
Therefore, things look and work a little different, especially creating posts and uploading images / attachments.


The important thing is we have a place toTalk, Learn and Showcase our projects.

Propeller program question

A place to talk about anything about Microcontrollers and Single Board Computers that does not fit in one of the below categories.
User avatar
jknightandkarr
Member
Member
Posts: 224
Joined: Tue May 12, 2015 5:11 pm
Location: Hopelessly lost on the USS-Titanic 968 years from home....
Contact:

Propeller program question

Postby jknightandkarr » Mon Sep 14, 2015 2:28 am

I am trying to learn to use the Frequency Counter & Oscilloscope, so thought I'd start with testin DTMF tones on the Propeller for accuracy and first step I thought was test the Propeller for the frequency its acctually running at. I tried to put the Clkfreq into a variable like "Freq:=clkfreq and output using the "SquareWaveTest.spin" in the Propeller Education Labs txt on pg 140 and I got a reading on the Freq Counter of 1.4xxxx Mhz, which I thought can't be right, Maybe the Propeller can't output freq higher then 1.4xxxx Mhz?? So I tried it a different way. Using "FullDuplexSerial.spin"

Code: Select all

CON
        _clkmode = xtal1 + pll16x                                               'Standard clock mode * crystal frequency = 80 MHz
        _xinfreq = 5_000_000

VAR                                                                     
  long  freq
   
OBJ

  Debug: "FullDuplexSerial"
 
PUB testfreq
             
  Debug.start(31, 30, 0, 57600)
   freq:=0
  repeat
    freq:=clkfreq
    Debug.str(string(" Mhz", 13))
    Debug.Dec(freq)
    waitcnt(clkfreq+cnt)


And after a moment of screwing around with what to send variables with Namely Debug.Dec I got a read out of exactly 80_000_000 Mhz on the Serial Terminal. Is this the correct way to do that to see the what the actual clkfreq is really running as? I am designing a product, which I posted on another thread, and it produces random DTMF tones, and just wanted to see if the desired freq to output is really being outputed. I thought I could adjust the data being passed to the FRQA & FRQB registers was being outputed as I wanted it. I tested the "SquareWaveTest.spin" on pg 140

Code: Select all

CON
   
  _clkmode = xtal1 + pll16x            ' Set up clkfreq = 80 MHz.
  _xinfreq = 5_000_000

PUB TestFrequency

  'Configure ctra module
  ctra[30..26] := %00100               ' Set ctra for "NCO single-ended"
  ctra[5..0] := 27                     ' Set APIN to P27
  frqa := 112_367                      ' Set frqa for 2093 Hz (C7 note) using:
                                       ' FRQA/B = frequency × (232 ÷ clkfreq)
  'Broadcast the signal for 1 s
  dira[27]~~                           ' Set P27 to output
  waitcnt(clkfreq + cnt)               ' Wait for tone to play for 1 s

Looked at the desired freq of 2093 Hz & compaired it to the Freq Counter Display, thinking that the 2093 Hz signal might be +/- alittle bit, and was going to mess around and try to adjust to create a perfict match. Well, it was a perfict match, and just wanted to verify that my above program that sends the clkfreq to the fraq variable and out to serial terminal was correct. I want to make the tones sound perfict cause some of these KR members are real sticklers for accuracy sometimes. Lol

Ok on the DTMF tones whats the better way to do it. Use 1 I/O Pin and FRQA + FRQB to send the 2 tones or send them out like this program does?
http://obex.parallax.com/object/60 And uses 2 I/O pins like this

Code: Select all

Circuit diagram:

all caps are 10µf
prop pin 0 >─||--┬──||──┬──┐
prop pin 1 >─---─┘           =     []< ←speaker                         
           ┌──────--------──┴──┘   
           v     
          VSS


Joe

BTW on "Debug.str(string(" Mhz", 13))" code. Whats the ,13 do?? The ed labs book dont say, unless I missed it.
Image
My website- Http://titaniceng.altervista.org/

My Facebookhttps://www.facebook.com/TitanicElectronicsGames/

~Owner, Designer & Builder Killer K.A.R.R.
~Starfleet Captain Joe R.
USS-Titanic Registry Number NCC-1513
Launched: Star Date 48509.9 Galaxy Class, Titanic Sub-Class Starship Max Warp: 15.96

User avatar
MrBi11
Member
Member
Posts: 9
Joined: Sat Aug 08, 2015 11:03 pm
Contact:

Re: Propeller program question

Postby MrBi11 » Mon Sep 14, 2015 9:14 pm

13 is the decimal value of an ASCII carriage return.

User avatar
jknightandkarr
Member
Member
Posts: 224
Joined: Tue May 12, 2015 5:11 pm
Location: Hopelessly lost on the USS-Titanic 968 years from home....
Contact:

Re: Propeller program question

Postby jknightandkarr » Tue Sep 15, 2015 12:47 pm

Ok thats explains the 13. Thanks.

joe
Image
My website- Http://titaniceng.altervista.org/

My Facebookhttps://www.facebook.com/TitanicElectronicsGames/

~Owner, Designer & Builder Killer K.A.R.R.
~Starfleet Captain Joe R.
USS-Titanic Registry Number NCC-1513
Launched: Star Date 48509.9 Galaxy Class, Titanic Sub-Class Starship Max Warp: 15.96


Return to “Microcontrollers and Single Board Computers: General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest