--- In jallist%40yahoogroups.com">jallist
yahoogroups.com, "hansvanveldhuizen"
<hansvanveldhuizen
...> wrote:
>
> Hi all,
> I am still looking for an interval routine to be used for serial
> communications (not the standard start, 8bit,stop) for the 16F877
under
> jal 2.0.( f.e. a sony sytem uses start,5 bits, 2 stops)
> I have tried to do something with the Tasks but no result.
> I hope there is a background routine for this.
> In my seatalk remote I have used a certain value in usec but that
> depends on the number of commands to be executed. Try and error!
> Who helps?
> Cheers
> Hans
>
Here is something I have tried, but not working, please comments:
-- JAL 2.0.4
include 16f877a_bert
pin_d0_direction = output
pin_d1_direction = output
pin_d2_direction = output
-- enable timer 0
option_reg = 0b_0000_0111
tmr0 = 200
-- the actual interrupt routine
procedure init_interval is
intcon = 0b_1010_0000
end procedure
procedure end_interval is
intcon = 0
end procedure
procedure next_interval is
var bit x at intcon:2 --- I had to do this because TOif was not ----
recognised by the compiler
while !x loop end loop
x=0
tmr0 = 200
end procedure
forever loop
-------------------------------------
pin_d0 = low -- to check the leds
pin_d1 = low
pin_d2 = low
delay_1S(1)
pin_d0 = high
pin_d1 = high
pin_d2 = high
-----------------------------------
pin_d0 = low -- something like waiting for a startbit
delay_1S(1)
pin_d0 = high
init_interval
for 5 loop -- now reading the bits
next_interval
pin_d1 = !pin_d1
end loop
end_interval
pin_d1 = 0 ------ now doing something with the received info
delay_1S(1)
pin_d2 = low
delay_1S(1)
pin_d2 = high
delay_1S(1)
end loop
Who puts me on the right trail?
Cheers Hans
.