Hi Steve, thank you for the explanation.
But the problem I have is not where the data is coming from it is the data itself. In the createArray program, the binary data is extracted and written to and ascii file. Therefore if the data were, 0x33, 0x1C, 0x29 the data stored in the 'to be flash' pages is: 0x3333, 0x3149, 0x3239. This is because all the nibbles high and low of the byte of the binary data is converted to an ascii equivalent and stored in 1 - 14 ascii files called output01.c --> output14.c. These are then built and loaded into the flash pages in the 9s12.
this code is from the arrayCreator.c source
unsigned char convertASCII(unsigned char asciiNibble)
{
if (asciiNibble <= 0x09) /* If nibble is less than 9 (ie. a number) */
return (asciiNibble + 0x30); /* Return the ASCII code for this number */
else /* Nibble must be a letter */
return (asciiNibble + 0x37); /* Return the ASCII code for this letter */
}
So you can see the ascii conversion for each nibble.
Then in the 9s12, the data is extracted one byte at a time from the flash pages created above and stored in the duty cycle register as per the
code in pwcontroller.c
Pwm.pwmdty[3].byte = *(wavPtr + sampleCounter); /* Load sample to PWM duty register */
sampleCounter ++; /*Increment sampleCounter */
Therefore ascii data is being stored in the duty cycle register as far as I can see.
Regards
Robert Lewis