Sign in

username:

password:



Not a member?

Search rabbit-semi



Search tips

Subscribe to rabbit-semi



Ads

Discussion Groups

Discussion Groups | Rabbit-Semi | Re: why can't I use anaInVolts and pwmOutVolts at the same time

This is a group for folks designing and programming embedded systems using the Rabbit Semiconductor C-programmable microcontroller. Rabbit Semi is a spin-off from Z-World who makes a variety of embedded modules and tools. This group is not affiliated with either Rabbit or Z-World, but is a user forum for sharing ideas, asking questions, flaunting knowledge, and other typical user group stuff. The Rabbit is a powerful uC, supported by a full-featured C-compiler.

Re: why can't I use anaInVolts and pwmOutVolts at the same time - Marinelle - May 24 14:44:24 2008

Hi Antonio,

I am running to the same problem as you are. How were you able to
resolve using pwm and anainvolts simultaneously?

Thanks!

Marinelle
--- In r...@yahoogroups.com, "antoniocalman"
wrote:
>
> Hi everyone, I am having an issue with anaInVolts and pwmOutVolts. I
> want to run a fan using pwmOutVolts and use anaInVolts to check the
> temp on a temperature sensor but whenever I try and set a steady
> voltage using pwmOutVolts and the program encounters anaInVolts there
> is an affect on pwmOutVolts because my fan loses speed for a fraction
> of a second and I need it to run steady. Its short code, if anyone
> can check and see how I can make the fan run steady, please let me
> know. I tried putting pwmOutVolts in its own costate but
> whenever "current=anaInVolts(0)" is updating the value, the DA0 seems
> to shut off.
>
> Antonio
>
> ohh, just in case u want to know. This program is controlling a relay
> that heats a resistor and a temp sensor reads its temp. The relay is
> shutting off after it reaches a certain temp, so I need to keep
> updates the current temp. thanks ahead of time for any suggestions.
> #class auto
> #define DA0 0
> #define DA1 1
>
> void DispStr(int x, int y, char *s)
> {
> x += 0x20;
> y += 0x20;
> printf ("\x1B=%c%c%s", x, y, s);
> }
>
> main()
> {
> int secs;
> float original,current,limit, volt;
> unsigned int i;
> brdInit();
> //inputnum = 0;
> original = anaInVolts(0);
> printf("original voltage is %f", original);
> limit = (original + (float)(0.02));
> secs = 0;
> printf("CH 0 is %.5f V\n", original);
> i = 1;
> pwmOutVolts(DA0, 0.0);
>
> current = anaInVolts(0); //checks current temp
>
> while(1)
> {
> pwmOutVolts(DA0, 2);
>
> costate{
> current=anaInVolts(0);
> }
>
> costate
> {
> waitfor(DelayMs(1000));
> if (current < limit && (i==1))
> {
> //DispStr(8,15, "Warming up to 10 deg above ambient");
> digOut(3,1);
> i=1;
> }
> else
> {
> digOut(3,0);
> i=2;
> if(current > original)
> {
> secs++;
> //printf("Elapsed Time = %d seconds\n\n",secs);
> //printf("original temp is %f", original); //
> added to check loop
> //printf("current temp is %f", current); //
> added to check loop
> }
> else
> {
> printf(" TOTAL ELAPSED TIME =
> %d seconds\n\n\n",secs);
> i=1;
> }
> }
> }
> }
> }
>

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )