Re: In need of some assistance for BATMAN pov graphics
Posted: Sat Sep 28, 2013 2:16 pm
Now theres an idea that just might work.
Thanks now to go ponder how to achieve results.
Thanks now to go ponder how to achieve results.
https://www.bradsprojects.com/forum/
https://www.bradsprojects.com/forum/viewtopic.php?f=17&t=890
Code: Select all
{
*****************************************************************************
* Name : UNTITLED.BAS *
* Author : [select VIEW...EDITOR OPTIONS] *
* Notice : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 10/08/2013 *
* Version : 1.0 *
* Notes : testing of trigget timing *
* : *
*****************************************************************************
}
Device = 18F2420
Clock = 8
Include "convert.bas"
Include"suart.bas"
Include"InternalOscillator.bas"
Dim R_un As Word
Dim led1 As PORTA.5
Dim led2 As PORTB.3
Dim count As Word
Dim s1 As PORTB.5
Dim s2 As PORTB.4
dim Trigger as word
UART.SetBaudrate(sbr9600)
UART.SetMode(umTrue)
UART.SetTX(PORTB.7) ' matches the PICkit 2 UART tool input pin when connected to the ICSP connector
Output (led1)
Output(led2)
led1=1
led2 = 1
input (S1)
input (S2)
R_un = 0
While 1 = 1
if S1 = 1 and R_un <1 then ' waiting for button press
delayms(100) 'switch debounce
R_un = 0
end if
If s1 = 0 and S2 = 1 Then ' button press
delayms(100) 'switch debounce
R_un = R_un + 1 'count time between pressing of S1 and S2
Low (led1) ' led1 is on
UART.Write("run =",DecToStr(R_un), 13, 10)
end if
if S1 = 1 and S2 = 1 then ' time between pressing S1 and S2 no button press
delayms(100) 'switch debounce
R_un = R_un +1 ' continue counting tiome between press of S1 and S2
end if
if S2 = 0 then Trigger = R_un ' S2 is pressed
delayms(100) 'switch debounce
UART.Write("Trigger =",DecToStr(Trigger), 13, 10)
Toggle (led1) ' turn off led1
low (led2) ' turn on led2
delayms(500)
toggle (led2) 'led2 off
R_un = 0 ' reset timer R_un
End If
UART.Write("run =",DecToStr(R_un), 13, 10)
'UART.Write("I like pizza", 13, 10)
'DelayMS(1000)
Wend
Code: Select all
{
*****************************************************************************
* Name : UNTITLED.BAS *
* Author : [select VIEW...EDITOR OPTIONS] *
* Notice : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 10/08/2013 *
* Version : 1.0 *
* Notes : testing of trigget timing *
* : *
*****************************************************************************
}
Device = 18F2420
Clock = 8
Include "convert.bas"
Include"suart.bas"
Include"InternalOscillator.bas"
Dim R_un As Word
Dim led1 As PORTA.5
Dim led2 As PORTB.3
Dim count As Word
Dim s1 As PORTB.4
Dim s2 As PORTB.5
Dim Trigger As Word
Dim mode As Byte ' sequence of events
Dim button_1 As Byte ' S1
Dim button_2 As Byte ' S2
Dim sensor_delay As Byte ' debounce
Sub check_buttons()
If mode = 0 And s1 = 1 And s2 = 1 Then mode = 1 ' waiting for button press
DelayMS(100) 'switch debounce
R_un = 0
End If
'xxxxxxxxxxxx
' START COUNTING TIME BETWEEN BUTTON PRESSES
If mode = 1 And s1 = 0 And s2 = 1 Then mode = 2 ' S1 button press start count
DelayMS(100) 'switch debounce
End If
'xxxxxxxxxxxxxxx
'zzzzzzzzzzzz
' STOP COUNTING INTERVAL
Trigger = R_un
If mode = 2 And s1 = 1 And s2 = 0 Then mode = 3 ' time between pressing S1 and S2 no button press
DelayMS(100) 'switch debounce
End If
If mode = 3 And s1 = 1 And s2 = 1 Then mode = 0
End If
End Sub
'zzzzzzzzzzzzzzzz
Sub increment_timer()
If mode = 0 Then R_un = 0
End If
If mode = 2 Then Inc (R_un)
End If
End Sub
Sub display()
UART.Write("timer =",DecToStr(R_un), 13, 10)
delayms(500)
UART.Write("mode =",DecToStr(mode), 13, 10)
End Sub
UART.SetBaudrate(sbr9600)
UART.SetMode(umTrue)
UART.SetTX(PORTB.7) ' matches the PICkit 2 UART tool input pin when connected to the ICSP connector
Output (led1)
Output(led2)
led1=1
led2 = 1
Input (s1)
Input (s2)
R_un = 0
mode = 0
While 1 = 1
check_buttons
increment_timer
display
Wend
Ortimer =
mode =
Code: Select all
timer =
mode =
Code: Select all
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =1
mode =2
timer =2
mode =2
timer =3
mode =2
timer =4
mode =2
timer =5
mode =2
timer =6
mode =2
timer =7
mode =2
timer =7
mode =3
timer =0
mode =0
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =1
mode =2
timer =2
mode =2
timer =3
mode =2
timer =4
mode =2
timer =5
mode =2
timer =6
mode =2
timer =6
mode =3
timer =0
mode =0
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0
mode =1
timer =0