hi all - having a timing issue and math not really my thing ... here is my code:
here is response in vb.net
^ 06:03.578 ^ 06:03.843 ^
06:06.406 ^ 06:06.656 ^
06:09.218 ^ 06:09.468 ^
06:12.031 ^ 06:12.296
vb.net code snp
this fires using the datareceived event.
Not giving me 1 sec or 10 sec , any help or suggestions,please?
I know vb has its own timing issues and even sending data 19200 has a msec or 2 per byte sent but this is too far off.
Code:
Define CONF_WORD = 0x3f32 'clock on HS
'mike gave me these in another thread: reaction timer
T2CON = 5
PR2 = 249
INTCON.T0IE = 0 'enable Timer0 interrupts
INTCON.GIE = True 'enable all un-masked interrupts
OPTION_REG.T0CS = False 'set Timer0 clock source to internal instruction cycle clock
AllDigital
Config PORTB = Output
Config PORTA = Output
Config PORTD = Input
Config PORTD.4 = Output
Config PORTC.0 = Input
Config PORTC.1 = Input
Config PORTC.2 = Input
Config PORTC.3 = Input
Config PORTC.4 = Input
Config PORTC.5 = Input 'rx
Config PORTC.6 = Output
Config PORTC.7 = Input
Hseropen 19200
'Define simulation_ 'waitms_VALUE = 1
'rows used for led and switches
Symbol row1 = PORTB.0
Symbol row2 = PORTB.1
Symbol row3 = PORTB.2
Symbol row4 = PORTB.3
Symbol row5 = PORTB.4
Symbol row6 = PORTB.5
'cols
Symbol col1 = PORTA.0
Symbol col2 = PORTA.1
Symbol col3 = PORTA.2
Symbol col4 = PORTA.3
Symbol col5 = PORTA.4
Symbol col6 = PORTA.5
'switches
Symbol sw1 = PORTC.0
Symbol sw2 = PORTC.1
Symbol sw3 = PORTC.2
Symbol sw4 = PORTC.3
Symbol sw5 = PORTD.0
Symbol sw6 = PORTD.1
'harware serial port
Symbol rx = PORTC.7
Symbol tx = PORTC.6
'switches to start and getinfo
Symbol btngo = PORTD.5
Symbol btnload = PORTD.6
Symbol speaker = PORTD.4
Dim ledon As Byte 'how long the led is on
Dim playmax As Byte 'how many frames to generate
Dim playmode As Byte 'mode 1 or 2
Dim playidx As Byte 'which frame we in
Dim btnpress As Byte 'which btn as pressed
Dim msec As Word 'this willhold the milli seconds
Dim i As Byte
Dim feed As Bit
Dim seed As Word
Dim temp As Word
Dim rand As Byte
Dim rcon As Byte
rcon = 1
'all off
PORTB = 0
PORTA = 0
PORTA = 255
WaitMs 500
PORTA = 0
PORTB = 255
WaitMs 500
PORTB = 0
PORTA = 0
PORTA = 255
speaker = 0
INTCON.T0IE = 1 'enable Timer0 interrupts
tme:
If msec = 1000 Then
INTCON.T0IE = 0 'disable Timer0 interrupts
Hserout 1
msec = 0
INTCON.T0IE = 1 'enable Timer0 interrupts
Goto tm2
Endif
Goto tme
'we waited for 1 sec now we wait for 10sec.
tm2:
If msec = 10000 Then
INTCON.T0IE = 0 'disable Timer0 interrupts
Hserout 1
msec = 0
INTCON.T0IE = 1 'enable Timer0 interrupts
Goto tme
Endif
Goto tm2
here is response in vb.net
^ 06:03.578 ^ 06:03.843 ^
06:06.406 ^ 06:06.656 ^
06:09.218 ^ 06:09.468 ^
06:12.031 ^ 06:12.296
vb.net code snp
Code:
Try
buff += Sp1.ReadExisting
If Mid(buff, 2, 1) = "C" Or Mid(buff, 2, 1) = "T" Or Mid(buff, 1, 1) = "" Then
txtRec.Text += " ^ " & DateTime.Now.ToString("mm:ss.fff") & buff '& vbCrLf
End if
catch
end try
this fires using the datareceived event.
Not giving me 1 sec or 10 sec , any help or suggestions,please?
I know vb has its own timing issues and even sending data 19200 has a msec or 2 per byte sent but this is too far off.