Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I checked your hardware wiring and I think it should work. I load the .hex file and I am getting a vertical line of 5 dots in the centre of the display. I try to open the PICbasic files but I dont have mikrobasic compiler so it cant be opened. I have pbp but the program listing doesnt help at all, all the procedure details are not shown.
I also tried to check the .lst and .asm but it was tedious. I put a scope on the trace and the timing looks OK. The time to display the digit "0" takes about 40mS on the PIC running at 1 MHz. So it should display 25 times per second. So I think the problem must be in the mikrobasic source code.
Please post the source in "code tags" so those that dont have the basic compiler can help you....;-)
Allen
'INCLUDE "16F88.INC"
'device pic16F88, xt_osc, wdt_on, mclr_on, lvp_off, protect_off
DEFINE OSC 4 ;4 MHz
Segments Var PORTB
adv_clock VAR PORTA.0
reset_clock VAR PORTA.1
i VAR Byte
TRISB = $00 ' Set segment pins to output
TRISA = $e0 ' Set digit pins to output
CMCON = $07
ANSEL = $00 'ALL RA DIGITAL
mainloop:
gosub reset_clk ' Reset 4017 to Q0
For i = 0 To 4 ' Loop through 4 digits
' Convert binary number to segments for LED
Lookup i, [$3e, $41, $41, $41, $3e], Segments
gosub adv_clk ' step column
Next i ' Do next column
GoTo mainloop ' Do it forever
reset_clk:
high reset_clock
low reset_clock
return
adv_clk:
high adv_clock
low adv_clock
return
END
I'm glad you finally got it.
Allen
I'll checked through all my notes and see if I can help.
Allen
[0..5]= $3e,$41,$41,41,$3e,$00
[6..11]= $41,$41,$41,$3e,$00,$3e
[12..17]=$41,$41,$3e,$00,$3e,$41
[18..23]=$41,$3e,$00,$3e,$41,$41
[24..29]=$3e,$00,$3e,$41,$41,$41
Hi,
To be able to scroll you have to create an array with 30 elements like this:
Code:[0..5]= $3e,$41,$41,41,$3e,$00 [6..11]= $41,$41,$41,$3e,$00,$3e [12..17]=$41,$41,$3e,$00,$3e,$41 [18..23]=$41,$3e,$00,$3e,$41,$41 [24..29]=$3e,$00,$3e,$41,$41,$41
The extra $00 is used as a blank column, so during scrolling the effect is clearer.
Set up 2 for/next loops. The inner loop would display 6 elements instead of 5 just like your original program. The outer loop of 5 would point to the 5 patterns above.
Let's say the outer loop is "For I" and inner loop is "For J", then the index for the array would be "I x 6 + J".
The 5 patterns would be displayed in turn to give the scrolling effect.
No change in hardware is needed.
Allen
[COLOR=#ff0000][code basic][/COLOR]
program MATRIX_5X7_3 'disp o on 8x8 dot matrix display
'colum scanning using 4017
'porta,0 is connected to 4017 clock pin
'porta,1 is connected to the 4017 reset pin
dim i as byte ' inner loop
[COLOR=#ff0000]dim j as byte ' outer loop[/COLOR]
const pattern as [COLOR=#ff0000]byte[30] = (0x3e,0x41,0x41,0x41,0x3e,0x00,.........)[/COLOR] 'letter o for scrolling pattern
Sub procedure Reset_Col()
porta.1 = 1 'reset 4017 when i>5
porta.1 = 0
end Sub
Sub procedure advance_Col()
porta.0=1 '4017 clock advance
porta.0=0
end Sub
main:
TRISA =0
TRISB =0
PORTB =0
while true
[COLOR=#ff0000]for j=0 to 4 'patterns for scrolling
[/COLOR]
Reset_col() 'reset 4017 t0 q0
for i=0 to [COLOR=#ff0000]5 '6 bytes per pattern[/COLOR]
portb =0 'clear matrix display for flickr and previous pattern
[COLOR=#ff0000] PORTB= pattern[jx6+i] 'load pattern to portb based on (i & j)'s values[/COLOR]
advance_Col() 'advance 4017 clock
next i 'next value of i
[COLOR=#ff0000]next j 'next pattern[/COLOR]
wend
end.