Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

voice recognition interface with zilog (code help)

Status
Not open for further replies.

markescat05

New Member
hello guys im just new here...
im having trouble with the program of vrBot in the zilog :(

the idea is the code is design for arduino microcontroller :( but its a must for us to use zilog microcontroller...

anybody here could translate this code that probably might work for zilog :


int redPin = 11; // R petal on RGB LED module connected to digital pin 11
int greenPin = 9; // G petal on RGB LED module connected to digital pin 9
int bluePin = 10; // B petal on RGB LED module connected to digital pin 10
byte com = 0; //reply from voice recognition

void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // sets the ledPin to be an output
pinMode(redPin, OUTPUT); // sets the redPin to be an output
pinMode(greenPin, OUTPUT); // sets the greenPin to be an output
pinMode(bluePin, OUTPUT); // sets the bluePin to be an output
delay(2000);
Serial.write(0xAA);
Serial.write(0x37);
delay(1000);
Serial.write(0xAA);
Serial.write(0x21);
}

void loop() // run over and over again
{

while(Serial.available())
{
com = Serial.read();
switch(com)
{
case 0x11:
color(255,255,255); // turn RGB LED on -- white
break;

case 0x12:
color(255, 0, 0); // turn the RGB LED red
break;

case 0x13:
color(0,255, 0); // turn the RGB LED green
break;

case 0x14:
color(0, 0, 255); // turn the RGB LED blue
break;

case 0x15:
color(0,0,0); // turn the RGB LED off
break;

}
}

}

void color (unsigned char red, unsigned char green, unsigned char blue) // the color generating function
{
analogWrite(redPin, red*102/255);
analogWrite(bluePin, blue*173/255);
analogWrite(greenPin, green*173/255);
}
[/I]
[/U]


im missing something with my program how can micro interpret the values given by the vrbot if it is in hexadecimal ...

thankyou..all.
 
Zilog is a company with many products. care to mention one you are using? and what does flashing few LEDs have to do with voice recognition?
 
ok, it looks like you are still learning how to control LEDs, there is a bit of learning curve before you get to signal processing or voice recognition.
Zilog has bunch of samples included with it's software (ZDS which is free from Zilog website). Also there are submissions that users have submitted as part of the z8 encore programming competitions.

here is one of code samples included with ZDS that uses serial port button(s) and LED(s). you can lower baud rate if you like.

note, this is from ZDSII 4.9 which is quite old now. just get current version from Zilog
 

Attachments

  • Z8F08xx_ledBlink.zip
    7.6 KB · Views: 253
thankyou for that reply... i figured it out using getch() :)
btw is it possible to use both uart0 and uart1 at one program?...cause ill be using uart1 for voice recog, and uart0 for pc communication.?, ive tried it but...it seems not to work properly... any idea to declare both.?
 
i expect it should work but i never needed to use more than one and don't think i have sample code
 
hehe its ok sir, ive figured it out already... all i need is to call the initialization each everytime i needed to switch from vrbot to pc. thankyou!
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top