Go to Post FIRST is good for us. It is good for our own Children. Don't give up, even if you are as tired as I am! - Kyle Hughes [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-05-2005, 03:49 PM
Barth Barth is offline
Registered User
AKA: Oliver Barth Heinemann
#1156 (Under Control)
Team Role: Programmer
 
Join Date: Mar 2005
Rookie Year: 2003
Location: Novo Hamburgo - RS - Brazil
Posts: 3
Barth is an unknown quantity at this point
digital output frequency

Hello everyone!

Is there any command in C language equivalent to freqout in Pbasic language, or a way to do a digital output oscillate in a 38500 frequency?

Thanks in advance
  #2   Spotlight this post!  
Unread 03-05-2005, 04:22 PM
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Re: digital output frequency

Oliver,

Take a look at Kevin's last year's beacon code (here), you can modify the EDU-RC code to do what you want. The code has lots of comments and should help you. Any questions, ask!
__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383
  #3   Spotlight this post!  
Unread 03-05-2005, 08:42 PM
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: digital output frequency

Quote:
Originally Posted by Barth
Hello everyone!

Is there any command in C language equivalent to freqout in Pbasic language, or a way to do a digital output oscillate in a 38500 frequency?

Thanks in advance
"freqout" is not a PBASIC command as far as I know...
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #4   Spotlight this post!  
Unread 03-06-2005, 12:18 AM
ConKbot of Doom ConKbot of Doom is offline
Team Alumni
FRC #1184 (Cobra Robotics)
Team Role: Leadership
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Maryland
Posts: 153
ConKbot of Doom has a spectacular aura aboutConKbot of Doom has a spectacular aura aboutConKbot of Doom has a spectacular aura about
Re: digital output frequency

You can use the CCP module on the PICs to get a signal on pwms 13-16 there is an example of that in the code I believe. If not its in one of the programming .pdf's somwhere. Not 100% sure all what you need to do, but check out some of the programming guides and datasheets on microchip.com about programming it too.
  #5   Spotlight this post!  
Unread 03-06-2005, 12:40 AM
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Re: digital output frequency

Quote:
Originally Posted by Mike Betts
"freqout" is not a PBASIC command as far as I know...
As a matter of fact, it is, we just didn't use it to program the robots in the PBasic era (2000-2003). This, and many other commands that weren't used can be found in the Basic Stamp Manual, from Parallax. Oliver probably used freqout with the BOEBots, some really nifty mini-robots that we also use at our school to teach robotics.

Oliver, I was kind of in a hurry (watching two webcasts at the same time ), so here's a bit of clarification from my previous post:
If you don't need to send those pulses at a precise rate, as the beacon code did last year, you can probably just use Kevin's LED Dimmer code to generate PWM signals. Using that file and the PIC18F8520 data sheet (pages 143-144 and 156-157) you can select the frequency you want.
As a matter of fact, I believe the following code (copy'n'paste inside the User_Initialization function in your user_routines.c file) will generate you a nice 38.46 KHz PWM with a 50% duty cycle. I don't have an RC or EDU in front of me right now to test it; if your application involves human safety, wait till someone more knowledgeable (yes, Kevin Watson ) approves this code, otherwise, just test it!
(be aware that using IFI's PWM will 'cause you trouble if using interrupt intensive code, especially Kevin's gyro code - both use Timer2)
Code:
         PR2 = 0x40;                 // sets 38461 Hz freq.
         CCPR2L = 0x20;             // sets 50% duty cicle
         T2CONbits.T2CKPS0 = 1;    // sets 1:4 prescale
	 T2CONbits.T2CKPS1 = 0;   // same as above
         T2CONbits.TMR2ON = 1;   // starts timer 2

         Setup_PWM_Output_Type(USER_CCP,IFI_PWM,IFI_PWM,IFI_PWM);
Also, don't forget calling Generate_Pwms(pwm13,pwm14,pwm15,pwm16); to generate the above signal in the PWM 13 output. [EDITED - This step is unnecessary, wrong and will probably give you an error. Disregard it!]

[EDIT] Why not just use last year's IR receivers (am I wrong assuming you want that particular 38500 Hz frequency for that? ), rated at 40 KHz, and use the code that's already available from a much much more reliable source?
__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383

Last edited by Manoel : 03-06-2005 at 01:07 AM. Reason: Added info
  #6   Spotlight this post!  
Unread 03-06-2005, 12:58 AM
Mike AA's Avatar
Mike AA Mike AA is offline
Programmer and Mentor
AKA: Mike Aalderink
FRC #3458 (Code Blue)
Team Role: Programmer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Holland, Mi
Posts: 698
Mike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to beholdMike AA is a splendid one to behold
Send a message via MSN to Mike AA
Re: digital output frequency

Quote:
Originally Posted by Mike Betts
"freqout" is not a PBASIC command as far as I know...
actually it is. and if you use the "boe-bot" from Radio shack it uses the freqout command.

-Mike

EDIT: ok, i didn't read ahead, it was already said, but the boe bots were a neat little device.
  #7   Spotlight this post!  
Unread 03-06-2005, 04:37 PM
Barth Barth is offline
Registered User
AKA: Oliver Barth Heinemann
#1156 (Under Control)
Team Role: Programmer
 
Join Date: Mar 2005
Rookie Year: 2003
Location: Novo Hamburgo - RS - Brazil
Posts: 3
Barth is an unknown quantity at this point
Re: digital output frequency

Thanks Manoel and Jonathan, I looked the codes with attention and I belive that using signal on pwms 13-16 it will works. Only a question, What does CCP mean?

Yes Manoel, you are right, I want do the same that we do with BOEBots, use IR sensor to detect objects. Don't worry my applications don't involves human safety.

I will try to do it monday and later I tell the results!
  #8   Spotlight this post!  
Unread 03-06-2005, 09:48 PM
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Re: digital output frequency

Quote:
Originally Posted by Barth
Thanks Manoel and Jonathan, I looked the codes with attention and I belive that using signal on pwms 13-16 it will works. Only a question, What does CCP mean?

Yes Manoel, you are right, I want do the same that we do with BOEBots, use IR sensor to detect objects. Don't worry my applications don't involves human safety.

I will try to do it monday and later I tell the results!
CCP stands for Capture/Compare/PWM. Again, the data sheet for the PIC is a very useful resource for more advanced programming. Download it here
__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383
  #9   Spotlight this post!  
Unread 03-06-2005, 09:58 PM
ConKbot of Doom ConKbot of Doom is offline
Team Alumni
FRC #1184 (Cobra Robotics)
Team Role: Leadership
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Maryland
Posts: 153
ConKbot of Doom has a spectacular aura aboutConKbot of Doom has a spectacular aura aboutConKbot of Doom has a spectacular aura about
Re: digital output frequency

Quote:
Originally Posted by Manoel
CCP stands for Capture/Compare/PWM. Again, the data sheet for the PIC is a very useful resource for more advanced programming. Download it here
Unfortunately for us though, the PWM outputs are outputs only so we cant use the capture or compare functions :-/ Might be handy for encoders, but oh well, we'll work with what we have.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Digital Caliper as a Digital Readout on Small Mill sanddrag Technical Discussion 9 10-13-2005 10:51 PM
Updated Encoder Code Available Kevin Watson Programming 2 01-04-2005 01:00 AM
Dynamic Input/Output Changing Paolo Control System 6 09-23-2004 07:09 PM
heres the code. y this not working omega Programming 16 03-31-2004 03:18 PM
digital inputs not valid just after initialization? WizardOfAz Programming 2 01-26-2004 01:21 PM


All times are GMT -5. The time now is 09:58 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi