I am interfacing 3 inch Fujitsu thermal printer (FTP-638MCL103) with STM32. Character printing is working fine. I am struggling to print smooth sine waves generated from a function generator.
I want to make this dotted waveform smoother.
Here is my code for plotting:
void adc_plot(uint16_t val){
uint8_t j = 36;
uint8_t LinePixels[72]={0}; // total 576 dots (72 * 8 dots)
j= (int)(val/14)+30;
LinePixels[j]=0x0f;
PrintDots8(LinePixels,72);
PrintDots8(LinePixels,72);
PrintDots8(LinePixels,72);
PrintDots8(LinePixels,72);
PrintDots8(LinePixels,72);
PrintDots8(LinePixels,72);
PrintDots8(LinePixels,72); /* multiple statements to make it darker horizontally */
LinePixels[j]=0x00;}
And code from main.c as follows
while (1){
#if 1
// HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, 1);
adc_val = HAL_ADC_GetValue(&hadc1);
adc_buf[i]=adc_val;
if(i>999)
i=0;
adc_plot(adc_buf[i]); // ploting the data from buffer
i++;
#endif}
Any idea how can I improve this?