serial translation trouble

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jim
 
Posts: 106
Joined: Wed Feb 20, 2008 12:15 am

serial translation trouble

Post by jim »

i want to write/play music from a serial controlled atmega 168 based MOS 6581 SID emulator i picked up this weekend. The design responds to actual register commands from a serial signal. i hope some of you know what i'm talking about better than i do.

i am having trouble plugging the 6581 datasheet info into two example Processing sketchs that make sound on the chip. For example, what does it mean to say, "there are 29 eight-bit registers in SID which control the generation of sound"?

at least part of my problem comes from not understanding hex values and their relationship to a serial signal. The numbers i see in the datasheet don't look to be in the same format as the numbers in the sketch. I don't remember any 0x numbers in the data sheet like there are in the sketch. Is that just a hex prefix?

Since i am messing with the sketch without understanding, i am just barely scratching the surface of an increasing itch.

this is one of the examples i am playing with:

Code: Select all

import processing.serial.*;
Serial port;         
int[] init = {
  4, 0x11, 5, 0x88, 6, 0x84}; //Triangle Wave with ADSR set
  /* note loop pattern written here */
int[] song = { 
  1, 0x08, 0, 0x93, 1, 0x0A, 0, 0xCD, 1, 0x0E, 0, 0x6B, 1, 0x08, 0, 0x93,1, 0x00, 0, 0x00,1, 0x00, 0, 0x00,1, 0x00, 0, 0x00 };



void setup(){

  println(Serial.list()); //prints a list of serial ports in the terminal window
  port = new Serial(this, "COM5", 9600);  // You must change "COM5" to the port your FTDI cable is using 

  for (int i=0; i<init.length;i++){
    port.write(byte(init[i]));

  }

}

void draw(){

  for (int i=0; i<song.length;i=i+2){
    port.write(byte(song[i]));        //writes song note
    port.write(byte(song[i+1]));
    delay(10);
    port.write(byte(4));              //sets ADSR gate
    port.write(byte(0x11));
    delay(10);
    delay(90);
    port.write(byte(4));              //releases ADSR gate
    port.write(byte(0x10));
    
    delay(40);
  }

}

User avatar
jim
 
Posts: 106
Joined: Wed Feb 20, 2008 12:15 am

Re: serial translation trouble

Post by jim »

i don't understand the relationship between "Address", (A0 - A4), "Reg # (Hex)", (00 - 1C), "Data", (D0 - D7) info on the data sheet, and the 0x00 number format in the sketch

User avatar
jim
 
Posts: 106
Joined: Wed Feb 20, 2008 12:15 am

Re: serial translation trouble

Post by jim »

well, i call it trouble when i can't get things to do what i want, but trouble resolution is my incentive to learn. Really this thread could be better with the inclusion of praise for Christoph Haberer, upon who's work, Wil Lindsay's A_SID chip kit is based.

recently i have learned that registers are memory locations on the chip.

the data sheet is confusing with 4 digit hex numbers being used with this 8 bit per register biz.
it is confusing that the data sheet mentions 12 or 16 bit numbers after stating that the 29 registers are 8 bit.

i thought Kurt Hebel, (another engineer from the cornfields), told me today that four digit hex numbers would represent 16 bits, or 8 bits in different, (sequential?) registers.

it's mostly greek to me, but until i can come up with a translation as fantastic as the BANNED-born-risen-from-the-dead, i will not stop.

i am dreaming of a meggy SID seq

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”