ON 20030309@9:17:02 AM at page:
http://www.piclist.compiclist/cheapic/bincnt.htm
JMN-EFP-786 James Newton removed post 37684.292974537
|Delete 'jhazt@webgate.net.ph asks:
write a program to simulate routing using flooding. Each Packet should contain counter that is decremented on each hop. When the counter gets to zero, the packet is discarded time is discrete with each line handling one packet per time internval. Make three versions of the program: all lines are flooded, all lines except the input line are flooded and only the (statically chosen) best k lines are flooded. Compare flooding with deterministric routing (k=1) in terms of delay and bandwidth used.
'
ON 20030310@2:33:36 PM at page:
http://www.piclist.compiclist/cheapic/binclock.htm
JMN-EFP-786 James Newton published post 37690.1434259259
hughe@thatinternetcafe.net "
if each loop is 0.976 msec then surely you want to loop 256 times to get a delay of 150ms?
msec250:
movlw H'FF'
"
|Delete 'P-' before: '' but after: 'hughe@thatinternetcafe.net "
(sorry, a delay of 250ms)"
|Delete 'P-' before: '' but after: 'rageshn@hotmail.com asks:
Hi, I am designing a systems to practice with. I want port A to be inputs and Port B as outputs.
I want three presses of A0 to represent a code incremented to give the value 3 (light up B0, B1 in Port B, However i want A1 to decrement it, representing a code to lock the system, and turn all lights off.
i want this to be anded with a normal switch A2 which lights up B2 and a short time delay before the light comes on.
I was wondering if you could help me with this or give me a few tips.
Thanks Ragesh Naik
|Delete 'P-' before: '' but after: '
First of all I want to say: Great tutorial! and Thanks !!
I try to change bit time delay to 26usec and use 38400 baud connection, but no matter what my sent, it always relay with "01 02 03" (HEX).
Anybody can help me out?
;-----------------------------------------------------------------------;
; transmit byte in W at 38400 baud out RB7 ;
;-----------------------------------------------------------------------;
; normal rs232 is -V for a high, +V for a low
; this would translate to 0V for high +5 for low
tx:
movwf txreg ; set up transmit register
comf txreg, f ; flip all bits
movlw D'8' ; eight bits to transmit
movwf bitcount
bsf PORTB, 7 ; start bit (+5V is 'low')
movlw D'5' ;
call micro4 ; 1(mov) + 2(call) + [4 * 4 + 5] = 24
txloop:
rrf txreg, f ; lsb out of txreg into carry
rrf PORTB, f ; bit 7 of port B high or low with carry
movlw D'4' ;
call micro4 ; 1(mov) + 2(call) + [4 * 3 + 5] = 20
nop ; Make it delay for 21
decfsz bitcount, f ; 4 instruction cycles to here
goto txloop ; total 4 + 3 = 7 instructions cycles in loop
nop ; Make 1 + 1(bcf) +24 for last bit delay
bcf PORTB, 7 ; 0 Volts is the 'high' state this is
movlw D'5' ;
call micro4 ; 1(mov) + 2(call) + [4 * 4 + 5] = 24
return ; 24 + 2(return) = 26 for stop bit
;-----------------------------------------------------------------------;
; receive byte at 38400 baud in RA0, put in W ;
;-----------------------------------------------------------------------;
rx:
startbit:
btfss incom ; 2 for startbit
goto startbit ;
movlw D'1' ;
call micro4 ; 1 + 2 + 5 = 8 usec
nop ; make 1 more delay
btfss incom ; 2 for still on high (till here start bit pass 13 usec)
goto startbit ; 2, Not a start bit, back to wait
movlw 8 ; 1, (Here ready for first Data bit, need delay for 26 usec)
movwf bitcount ; 1
clrf rxreg ; 1, clear out register
movlw D'4' ;
call micro4 ; 1 + 2 + (4 * 3 + 5) = 20 (total here is 23)
nop ; 1
nop ; 1, make to 25 usec delay
receive:
rrf PORTA, f ; 1, PORT A bit 0 into carry (till here Finish 26 usec delay)
rrf rxreg, f ; 1, rotate carry into receive register (start For Next Bit)
movlw D'4' ;
call micro4 ; 1 + 2 + (4 * 3 + 5) = 20
nop ; 1, make to 22 usec delay (total here is 22)
decfsz bitcount, f ; 1(2)
goto receive ; 2
nop ; 1, last bit delay 25
comf rxreg, W ; 1, Flip All Bits (End Of Last Bit 26 usec delay)
movlw D'5' ; ( Wait For Stop Bit Start From Here)
call micro4 ; 1 + 2 + (4 * 4 + 5) = 24
return ; 2 (Stop Bit Completed)
end
|Delete 'P-' before: '' but after: '