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

pic16F873 taking MIDI-in and generating PWM

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



Joined: 28 Apr 2004
Posts: 5

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

pic16F873 taking MIDI-in and generating PWM
PostPosted: Wed Apr 28, 2004 12:02 pm     Reply with quote

Hi all,
I am an experienced C programmer but have never programmed for a pic chip before - in this case the PIC16F873. I want to take a MIDI-note velocity (values in the range 0-127) as input to the chip and have an LED blink on and off (using PWM) at a rate depending on the number value the pic chip recieves.......... So the rate of the PWM will be controllable via MIDI.......
Could anyone point me in the direction to start off......... It would really be appreciated.....
Regards,
L
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

PostPosted: Thu Apr 29, 2004 4:37 pm     Reply with quote

Let's start with the basics:

Do you have the CCS compiler?

What hardware are you using beyond the 873? Does it have a MIDI interface already or do you need help with that also?

The hardware PWM will generate a fairly high frequency, in the kiloHz range, and not actually blink on and off to the eye. As you change the duty cycle, the LED will appear to dim and brighten. Is that ok, or so you need a true blink at let's say a couple of Hz.

The ball is in your court. Arrow
caffca



Joined: 28 Apr 2004
Posts: 5

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

pic16F873 taking MIDI-in and generating PWM
PostPosted: Fri Apr 30, 2004 7:29 am     Reply with quote

Hi Charlie,
First of all, I really appreciate the reply.... This is a bit of a grey area for me.....

I'm not using the CCS compiler.... I am using "C for PICmicro microcontrollers V2.0 by Rob Miles" to program my C code and compile the HEX file, and then I'm using MPLAB V5.11 to convert the HEX file to assembly code which is then uploaded to the "PICStart Plus" (which holds the PIC16F873 chip). Just in case you're concerned with the version of MPLAB I am using, I have to use this version as the PICStart Plus I have will not work with the latest version of MPLAB (V6.5).

Hardware I am using:
For the moment I am using 1 LED with the appropriate resister for it....
A 9V battery.......
An "AEL1210CSN 8.000" quartz clock crystal

I have the MIDI-Input socket but I'm not sure where to connect with in relation to the PIC. I know I should use pins 2 and 4 - but thats about it........

A schematic for the basic circuit and a code example corresponding to the schematic would be ideal for me.... I have searched the net but can't find basic enough examples.......... I need to get something actually visually working on the circuit before I can really get stuck in.....

A true blink of a couple of hertz would be ideal - but for the moment even to have the MIDI velocity value change the DUTY cycle in any way would be excellent.

Thanks again for the reply Charlie,

Caffca


Charlie U wrote:
Let's start with the basics:

Do you have the CCS compiler?

What hardware are you using beyond the 873? Does it have a MIDI interface already or do you need help with that also?

The hardware PWM will generate a fairly high frequency, in the kiloHz range, and not actually blink on and off to the eye. As you change the duty cycle, the LED will appear to dim and brighten. Is that ok, or so you need a true blink at let's say a couple of Hz.

The ball is in your court. Arrow
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

PostPosted: Fri Apr 30, 2004 1:26 pm     Reply with quote

First of all, this forum is for CCS C compiler users. It is provided by CCS for users to exchange information on programming details, ideas, problems, etc. If you are using some other compiler, I probably won't be able to help with the code much, since I have only used the CCS compiler.

Regarding hardware you could start at the following site for interface information:

http://www.borg.com/~jglatt/tech/midispec.htm

Look for hardware info.
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