Hello Darrel,
yes your are right, very scary!
And yes I use the scope, because of controlling the puls length (µs).
What I have done again:
I reduce the code a little bit and I change/simplified some parts.
Code:I replace this: Char_Temp = Char << 1 ; Shift Up Lower 4 Bits Char_Temp = Char_Temp << 1 Char_Temp = Char_Temp << 1 Char_Temp = Char_Temp << 1 with this: Char_Temp = Char & %00001111 ; Shift Up Lower4 Bits @ swapf _Char_Temp ,F
Also I reduce the Upper an Lower Nibbel Part from 6 to only 4 Steps.
Because Toggle the Enable Bit again is not necessary.Code:SELECT CASE Count_ShiftOut_Steps CASE 0 Char_Temp = Char & %11110000 ; Isolate Upper 4 Bits If RSS = 1 Then : Char_Temp = Char_Temp | %00000100 ; Set RS Bit CASE 1, 3 Char_Temp = Char_Temp | %00001000 ; Set Enable Bit Case 2 Char_Temp = Char & %00001111 ; Shift Up Lower4 Bits @ swapf _Char_Temp ,F If RSS = 1 Then : Char_Temp = Char_Temp | %00000100 ; Set RS Bit END SELECT
Further, I change (Post 6, Point 2...."Although I have a feeling it can be reduced somehow")
Up to now, the code runs very good. (I Think a little bit better then before.)Code:This: ;----[Shift_Routine_74HC595 ]---------------(DO NOT Change)------------------- ShiftLoop_Steps = 7 ShiftLoop: Readout_Bit = Bit_Shift.7 SELECT CASE Readout_Bit CASE 1 Serial_Pin = 0 : @ DelayUS 1 ; min 1 µs for 1 Serial_Pin = 1 : @ DelayUS 15 ; min 15 µs Case 0 Serial_Pin = 0 : @ DelayUS 15 ; min 15 µs for 0 Serial_Pin = 1 : @ DelayUS 30 ; min 30 µs END SELECT Bit_Shift = Bit_Shift << 1 ShiftLoop_Steps = ShiftLoop_Steps - 1 IF ShiftLoop_Steps != 0 THEN : Goto ShiftLoop ;Latch Serial_Pin = 0 : @ DelayUS 200 ; min 200 µs for Latch Serial_Pin = 1 : @ DelayUS 300 ; min 300 µs Next To This: ;----[Shift_Routine_74HC595 ]---------------(DO NOT Change)------------------- ShiftLoop: For ShiftLoop_Steps = 0 to 6 @ rlf _Bit_Shift, F ; Shift 1.Pos left If STATUS.0 = 1 Then ; Carry Flag Serial_Pin = 0 : @ DelayUS 1 ; min 1 µs for 1 Serial_Pin = 1 : @ DelayUS 15 ; min 15 µs else Serial_Pin = 0 : @ DelayUS 15 ; min 15 µs for 0 Serial_Pin = 1 : @ DelayUS 30 ; min 30 µs endif next ;Latch Serial_Pin = 0 : @ DelayUS 200 ; min 200 µs for Latch Serial_Pin = 1 : @ DelayUS 300 ; min 300 µs Next
But sometimes when I simulate it on the PC, after some time, the LCD shows only cryptic characters.
Then I have to restart the simulation again an all works fine.
What du you think, is there something one can improve?
Thanks in advance!




Bookmarks