cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

HaHa_285681
New Contributor

Hi to everyone, 

   


I need to send decimal numbers via SPI master, but  SPIM_WriteTxData(), can send only hex numbers.
How to send decimals? how can I convert them to hex and then put in SPIM_WriteTxData() function? 

   


regards,
Hakob

0 Likes
17 Replies
HeLi_263931
Honored Contributor II

The SPIU writes _binary_ data. It does not care about hex vs. decimal, this is something you need to handle in your program.

   

Maybe you can explain a little bit more about what you actually want to do?

0 Likes
HaHa_285681
New Contributor

I have a function which gives, five outputs (int8 decimal) and I need to send them via SPI master to external DAC to get output volts.

0 Likes
Bob_Marlowe
Expert II

Can you evolve whether your function values are ASCII characters (which I doubt) or just the values ? When you provide us with a link to your DAC we can probably help you better.

   

 

   

Bob

0 Likes
HaHa_285681
New Contributor

Dear Bob,

   

I will check for it for ASCII.
Do I need to save the files of my function as a ASCII? 
Here is details of my DAC 
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5308_5318_5328.pdf

   

regards,
Hakob

0 Likes
HaHa_285681
New Contributor

It is  c89/c90(ANSI) 

0 Likes
Bob_Marlowe
Expert II

Your datasheet shows that you will have to transmit 16 bit binary words to your DAC, no decimal, no ASCII. Look at the serial interface description of the DAC which shows exactly what is expected.

   

You will have to do some bit-merging in C-language to construct the values to transmit.

   

 

   

Bob

0 Likes
HaHa_285681
New Contributor

Dear Bob,

   

it is my DAC, it doesn't respond as it must, I have to change.
I had given hex numbers corresponding to its binary command and followed SPIM output signals via oscilloscope. Clocking signals and data signals were expected as binary command. Anyway it doesn't respond for some DACs and 256 resolution.
Can you suggest some known DAC which vould work corectly ?

   

regards,
Hakob 

0 Likes
Bob_Marlowe
Expert II

Sorry Hakob,

   

I am a digital man. Someone else will have to support you with analog information. What are the specs that have to be fulfilled for your DAC?

   

 

   

Bob

0 Likes
HaHa_285681
New Contributor

I need to generate some biological potentials.

   

regards,
Hakob

0 Likes
Bob_Marlowe
Expert II

With "Specs" I mean Electrical specifications as

   

Supply voltage, accuracy, precision speed etc.

   

 

   

Bob

0 Likes
HaHa_285681
New Contributor

I need to generate approximately 100 step voltage graph by random value (between 0-2 volt).

   

regards,
Hakob

0 Likes
Bob_Marlowe
Expert II

This would mean that an 8-bit DAC would be sufficient, no external part needed except when needed an amplifier. So what is the reason you do not use an internal DAC

   

 

   

Bob

0 Likes
HaHa_285681
New Contributor

I have 4-5 outputs, in PSOC 5LP only 2 DACs.

   

regards,
Hakob

0 Likes
Anonymous
Not applicable

Hi Hakop
 

   

maybe you can use the DACs followed by analog multiplexer ?

   

All the Best
Frank

0 Likes
HaHa_285681
New Contributor

Hi Franksanderdo

   

​ I need 5 different outputs as random voltage sources. Can I use one VDAC and one multiplexer and do what I want ? 

   

regards,

   

Hakob

0 Likes
Anonymous
Not applicable

Hi Hakop,

   

sorry for late answer.
You can feed from one VDAC into a multiplexer and then into a sample and hold circuit.
PSOC 5LP has sample and hold component, but (unfortunately) not enough resources to do 5,
Last time I have used a capacitor / opamp combination combination to sample & hold the output.

   

All the Best
Frank

0 Likes
HaHa_285681
New Contributor

Hi Franksanderdo,

   

I have solved the problem by changing cy8c5468axi-lp106 (has 2 VDAC) to cy8c5868axi-lp 032 (has 4 VDAC).

   

Regards ,

   

Hakob

0 Likes