Robson
- 21st June 2007, 01:11
Hi there,
Iīm a beginner in PicBasic and i want write my first program. It was really hard enough for me to change the configuration bits of this PIC cause of WDT problems.
Now my question is very simple.
Is it possible, that the PIC is running two different processes at the same time?
e.g. the 1st process only works once, when power up my board
and the second part is searching for a pressed button (matrix)
How can i solve this problem that both parts work simultanously?
Maybe someone can help me?
Iīm using MicroCode Studio v3.0.0.0, Pic Basic Pro Compiler v2.47 & MPLAB IDE V7.60
I hope that my english isnīt too bad and you can understand me...
'****************************************
'* Name : Matrix.BAS *
'* Author : Robson *
'* Notice : *
'* : All Rights Reserved *
'* Date : 20.06.2007 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************
' first process starts here
' this routine should run once by power up the PIC
for x = 1 to 5 ' Wait 10 Seconds
pause 2000
next x
PORTB.1 = 0
for x = 1 to 3 ' Wait 6 Seconds
pause 2000
next x
PORTB.1 = 1
for x = 1 to 2 ' Wait 4 Seconds
pause 2000
next x
PORTB.1 = 0
' this was the 1st part which only runs on startup
' for this time (20 seconds) the input on the matrix donīt work
goto main
' here starts the second Part which should run simultanously
' while the first part is running
main:
col1 = 1
col2 = 0
col3 = 0
savepos = pos
if row1 = 1 then
pos = 4
endif
if row2 = 1 then
pos = 3
endif
if row3 = 1 then
pos = 2
if savepos = 0 then goto main
endif
goto col2check
' etc .......
goto main
end
Iīm a beginner in PicBasic and i want write my first program. It was really hard enough for me to change the configuration bits of this PIC cause of WDT problems.
Now my question is very simple.
Is it possible, that the PIC is running two different processes at the same time?
e.g. the 1st process only works once, when power up my board
and the second part is searching for a pressed button (matrix)
How can i solve this problem that both parts work simultanously?
Maybe someone can help me?
Iīm using MicroCode Studio v3.0.0.0, Pic Basic Pro Compiler v2.47 & MPLAB IDE V7.60
I hope that my english isnīt too bad and you can understand me...
'****************************************
'* Name : Matrix.BAS *
'* Author : Robson *
'* Notice : *
'* : All Rights Reserved *
'* Date : 20.06.2007 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************
' first process starts here
' this routine should run once by power up the PIC
for x = 1 to 5 ' Wait 10 Seconds
pause 2000
next x
PORTB.1 = 0
for x = 1 to 3 ' Wait 6 Seconds
pause 2000
next x
PORTB.1 = 1
for x = 1 to 2 ' Wait 4 Seconds
pause 2000
next x
PORTB.1 = 0
' this was the 1st part which only runs on startup
' for this time (20 seconds) the input on the matrix donīt work
goto main
' here starts the second Part which should run simultanously
' while the first part is running
main:
col1 = 1
col2 = 0
col3 = 0
savepos = pos
if row1 = 1 then
pos = 4
endif
if row2 = 1 then
pos = 3
endif
if row3 = 1 then
pos = 2
if savepos = 0 then goto main
endif
goto col2check
' etc .......
goto main
end