View unanswered posts | View active topics It is currently Tue Jul 29, 2014 4:42 am






Reply to topic  [ 5 posts ] 
Bug? Audio output doesn't seem to be working. 
Author Message
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Bug? Audio output doesn't seem to be working.
I have a Piezo buzzer connected with the "+" to digital port 10, and the "-" to GND. If I use this code:
Code:
#pragma config(CircuitBoardType, typeCktBoardUNO)
#pragma config(UART_Usage, UART0, uartSystemCommPort, baudRate200000, IOPins, dgtl1, dgtl0)
#pragma config(Motor,  servo_10,        ,              tmotorAudio, openLoop, IOPins, None, None)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
  for(int i = 0; i <=  127; i++)
  {
    motor[servo_10] = i;
    wait1Msec(400);
  }
}


Then it should do an upward sweep of tones, right? Instead, it gives me this error screen:
Attachment:
File comment: ERROR!
RobotC_exception.jpg
RobotC_exception.jpg [ 53.98 KiB | Viewed 2421 times ]


Am I doing this right? Or is it a bug?

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Fri May 18, 2012 9:13 am
Profile WWW
Rookie

Joined: Mon May 14, 2012 3:24 pm
Posts: 43
Post Re: Bug? Audio output doesn't seem to be working.
Not at computer so just guessing but did you try it on port 5 or 6 ? 9 & 10 normally used for servo motors and maybe the code doesn't like you using it for generating a tone.


Fri May 18, 2012 7:38 pm
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: Bug? Audio output doesn't seem to be working.
Dennis Mabrey wrote:
Not at computer so just guessing but did you try it on port 5 or 6 ? 9 & 10 normally used for servo motors and maybe the code doesn't like you using it for generating a tone.


Here's what I've tried: (these are all the standard variable intensity commands as far as I can tell)
Code:
#pragma config(Motor,  servo_10,        ,              tmotorAudio, openLoop, IOPins, None, None)
#pragma config(Motor,  motor_5,         ,              tmotorVariableIntensityLED, openLoop, reversed, IOPins, dgtl5, None)
#pragma config(Motor,  motor_6,         ,              tmotorAnalogWrite, openLoop, IOPins, dgtl6, None)


None of these produce any results. Any other ideas? Has anybody else tried this?

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Fri May 18, 2012 11:48 pm
Profile WWW
Rookie

Joined: Mon May 14, 2012 3:24 pm
Posts: 43
Post Re: Bug? Audio output doesn't seem to be working.
Yes I get the same error. Using a logic analyzer it seems only the external h-bridge types are working.

Nothing else appears to work properly. analogWrite and variable LED do not generate a PWM signal.

Servos don't work as well. For example setting the motor value to 126 only generates a 9% duty cycle:

Code:
#pragma config(CircuitBoardType, typeCktBoardUNO)
#pragma config(UART_Usage, UART0, uartSystemCommPort, baudRate200000, IOPins, dgtl1, dgtl0)
#pragma config(Motor,  motor_6,         ,              tmotorServoStandard, openLoop, IOPins, dgtl6, None)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main(){
    while(true){
      motor[motor_6] = 126  ;
    }
}



Image

Changing the value didn't really change the signal much (value of 1 gave a 7% duty cycle).

More than likely they would not use the motor array to set these motor types anyway. Servos should be set by angle, audio by tone and duration, and analogWrite would be a value from 0-255.

It's beta so it just hasn't been implemented yet.


Sat May 19, 2012 12:14 pm
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: Bug? Audio output doesn't seem to be working.
Dennis Mabrey wrote:
Yes I get the same error. Using a logic analyzer it seems only the external h-bridge types are working.

Nothing else appears to work properly. analogWrite and variable LED do not generate a PWM signal.

Servos don't work as well. For example setting the motor value to 126 only generates a 9% duty cycle:

Code:
#pragma config(CircuitBoardType, typeCktBoardUNO)
#pragma config(UART_Usage, UART0, uartSystemCommPort, baudRate200000, IOPins, dgtl1, dgtl0)
#pragma config(Motor,  motor_6,         ,              tmotorServoStandard, openLoop, IOPins, dgtl6, None)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main(){
    while(true){
      motor[motor_6] = 126  ;
    }
}



(image ommited)

Changing the value didn't really change the signal much (value of 1 gave a 7% duty cycle).

More than likely they would not use the motor array to set these motor types anyway. Servos should be set by angle, audio by tone and duration, and analogWrite would be a value from 0-255.

It's beta so it just hasn't been implemented yet.


I suspected as much. But, I don't have a logic analyzer (or oscilliscope) so I couldn't be sure. I thought it was strange to have the "motor" command for all those things. Thanks for trying.

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Sat May 19, 2012 12:41 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.