Hello,
with this sw (Mikrobasic) I'm trasmitting 3 values, obtained by pic with an ADC conversion, through serial port.
I receive the values with the sw Yperterminal in this format xxxxx,xxxxx,xxxxx;xxxxx,xxxxx,xxxxx; etc....up to 84 groups of 3.
I'd rather do this with VBA of Excel to obtain a few curves (or VB6).
Can you help me with some examples?
Thank you
Bye
Antonio
with this sw (Mikrobasic) I'm trasmitting 3 values, obtained by pic with an ADC conversion, through serial port.
I receive the values with the sw Yperterminal in this format xxxxx,xxxxx,xxxxx;xxxxx,xxxxx,xxxxx; etc....up to 84 groups of 3.
I'd rather do this with VBA of Excel to obtain a few curves (or VB6).
Can you help me with some examples?
Thank you
Bye
Antonio
Code:
program adc3_232
'******************************************************************************
' microcontroller P16F877A
' http://www.mikroe.com/forum/viewtopic.php?t=5878&highlight=datalogger
' Project: adconlcd
' This project is designed to work with PIC 16F877A
' with minor adjustments, it should work with any other PIC MCU
' that has ADC module.
'
' This code demonstrates how to use library function ADC_read, and library
' procedures and functions for LCD display (4 bit interface)
' It sends the ADC conversion through USART.
'******************************************************************************
dim t as word
Text as char[20]
tword as string[5]
i as byte
sub procedure end_adc
lcd_cmd(LCD_CLEAR)
lcd_out(1,1,"sampling")
lcd_chr(2,9,"E")
lcd_chr(2,10,"N")
lcd_Out(2,11,"D ")
' Usart_Write(",")
delay_ms(200)
end sub
sub procedure setup
lcd_cmd(LCD_CLEAR)
lcd_out(1,1,"Inizializing")
lcd_chr(2,9,"S")
lcd_chr(2,10,"T")
lcd_Out(2,11,"ART")
' Usart_Write(",")
delay_ms(200)
end sub
sub procedure sec1
t = ADC_read(0)
lcd_cmd(LCD_CLEAR)
Text = "V1"
lcd_out(1,1,Text)
lcd_chr(2,15,"V")
wordtostr(t,tword)
Usart_Write_text(tword)
'lcd_chr(2,9,48+ch)
'lcd_chr(2,11,".")
lcd_out(2,3,tword)
Usart_Write(",")
delay_ms(100)
end sub
sub procedure sec2
t = ADC_read(1)
lcd_cmd(LCD_CLEAR)
Text = "V2"
lcd_out(1,1,Text)
lcd_chr(2,15,"V")
wordtostr(t,tword)
Usart_Write_text(tword)
'lcd_chr(2,9,48+ch)
'lcd_chr(2,11,".")
lcd_out(2,3,tword)
Usart_Write(",")
delay_ms(100)
end sub
sub procedure sec3
t = ADC_read(2)
lcd_cmd(LCD_CLEAR)
Text = "V3"
lcd_out(1,1,Text)
lcd_chr(2,15,"V")
wordtostr(t,tword)
Usart_Write_text(tword)
'lcd_chr(2,9,48+ch)
'lcd_chr(2,11,".")
lcd_out(2,3,tword)
Usart_Write(";")
delay_ms(100)
end sub
main:
Usart_Init(9600)
TRISC=0x00
PORTB =2
TRISB =0
intcon =0
Lcd_init(PORTD)
lcd_cmd(LCD_CURSOR_OFF)
lcd_cmd(LCD_CLEAR)
'Text ="curve tracer"
lcd_out(1,1,"datalogger")
Text ="A. Durighello"
lcd_out(2,1, Text)
'Setbit(PORTB,1) 'for usb project
OPTION_REG = $80
ADCON1 = $82
TRISA = $FF
Delay_ms(200)
lcd_cmd(LCD_CLEAR)
Text = "Samples:"
lcd_out(2,1,Text)
setup
for i = 0 to 83 '(84x3 samples=252)
sec1
sec2
sec3
next i
' while true
' 'setup
' sec1
' sec2
' sec3
'' sec4
'
' wend
'Usart_Write(";")
end_adc
end.