CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

The first 12 notes of the top octive musical scale?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Mark A Carter



Joined: 28 Aug 2011
Posts: 5
Location: Vail Arizona USA

View user's profile Send private message Send e-mail Yahoo Messenger

The first 12 notes of the top octive musical scale?
PostPosted: Thu Nov 07, 2013 12:13 am     Reply with quote

Confused

Dear programmers.
How can I code the PIC18F67J10 trainer PCB to generate the first 12 monochromatic top octave square wave notes on the music scale? On the free connector output port pins. How would I write a simple CCS C code snippet to setup a 16 Bit timer in this IC and when it reaches for example divide by 508 it will interrupt the chip? Then it must change the state of the pin on one of the free connector output port pins.

From your examples I should add onto it the code to generate the 11 more tone outputs.

I know that the old National IC that did this task is discontinued and is now obsolete.

Thank you.

Mark A Carter
_________________
Mark A Carter

KD7PHW
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Nov 07, 2013 12:24 am     Reply with quote

This CCS example doesn't use your proposed method but you can start
by looking at it:
Quote:
c:\program files\picc\examples\ex_tones.c
c:\program files\picc\drivers\tones.c
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Nov 07, 2013 3:28 pm     Reply with quote

The 16f1509 will give you any note you want, even with the internal oscillator. Very Happy Very Happy
and have plenty of unimpaired CPU cycles left over.

http://www.ccsinfo.com/forum/viewtopic.php?t=50121
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Fri Nov 08, 2013 4:14 am     Reply with quote

Are you wanting to generate all twelve tones at the same time, or just one at once?

If you examine the data sheet for the TOS chips, you will see there were two versions with different divisor ratios.
One version was accurate to 3 cents, the other to 1 cent.
(One cent being 1semitone/100 i.e. ~1 part in 2000)

The 3 cents version gave some musical fifths which were just intoned. The upper tone frequency was exactly 3/2 the lower one. They did not sound right.

The hardware PWM output from many smaller PICs will do 50% duty ratio and 10 bit resolution. That should do the job for you, if you only want one tone at a time.

Mike
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group