This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Sending Waveform Calculations to Logic Analyzer using Analog: STM32F103RB Board

We are trying to generate via code a sawtooth waveform and output a graph of it to the logic analyzer. The calculations for the sawtooth equation are more or less done. We just don't know how to use a gpio analog port to display it on the logic analyzer. 

This is the code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void sawtooth (void const *argument)
{
float amplitude; // peak-to-peak amplitude
float frequency; // output frequency in Hz
float offset; // amplitude offset
float duration; // duration in Seconds
float val;
int state;
osEvent result;
for(;;)
{
result = osSignalWait (0x00,0);
switch(result.value.v)
{
case 1:
SendText("Running sawtooth \n\n");
state = 1;
break;
case 2:
state = 2;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

We are aware that the following code exists on Keil's website but it does not work on the board we are required to use.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*---------------------------------------------------*/
/* Generate Sawtooth Signal on AD Channel 1 */
/*---------------------------------------------------*/
//
SIGNAL void AIN1_Saw (void) {
float volts; // peak-to-peak volatage
float frequency; // output frequency in Hz
float offset; // volatge offset
float duration; // duration in Seconds
float val;
long i, end, steps;
volts = 2.0;
offset = 0.2;
frequency = 1400;
duration = 0.2;
printf ("Sawtooth Signal on AD Channel 1.\n");
steps = (100000 * (1/frequency));
end = (duration * 100000);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

0