I'm newbie on GCBASIC and microcontrollers.
I'm trying to display values using 2 displays, I'm using this code, originally from another post from this forum but I'll never be able to display values on the second display.
The schematic seems to be ok but, I only get the message on PORTA.0,
never on PORTA.1, display 2.
I suspect that the problem can be in the define area but I don't know where, can anyone help?
Thank you
Eduardo Freitas
'=================================================
'Chip model
#chip 16F628A, 4
#config OSC = XT, WDT = OFF
#define StartUpDelay 10 ms
'setting the 7 segment display with 2 displays
#define displaycount 2
#define DisplayPortA PORTB
#define DisplayPortB PORTB
#define DispSelectA set PORTA.0 ON set PORTA.1 OFF
#define DispSelectB set PORTA.0 OFF set PORTA.1 ON
dir PORTB.0 out
dir PORTB.1 out
dir PORTB.2 out
dir PORTB.3 out
dir PORTB.4 out
dir PORTB.5 out
dir PORTB.6 out
dir PORTB.7 out
dir PORTA.0 out
dir PORTA.1 out
Startup:
Wait StartUpDelay
'================================================================
'===== MAIN PROGRAM LOOP
'================================================================
Dim Message(10)
Message() = "Hello "
Main:
for DispMessage = 1 to 6
DisplayChar 1, Message(DispMessage)
wait 25 10ms
DisplayChar 2, Message(DispMessage)
wait 25 10ms
next
Goto Main
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think multiplexing will take a little more work on the definition side, plus doubtful about trying to string two consecutive conditions after a definition. Not real sure on how the DispSelectA/B/C/D relationship works, maybe best to manually set the displays on and off. Also, don't see where DisplayCount comes into play with the 7segment.h file.
Try the following:
...
...
...
#define DispSelectA nop
#define DispSelectB nop
#define Display1 PortA.0
#define Display2 PortA.1
#define waitDisplay wait 12 ms
...
...
...
for DispMessage = 1 to 6
Set Display2 OFF:Set Display1 ON
DisplayChar 1, Message(DispMessage)
waitDisplay
Set Display1 OFF:Set Display2 ON
DisplayChar 2, Message(DispMessage)
waitDisplay
next
goto Main
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi to all,
I'm newbie on GCBASIC and microcontrollers.
I'm trying to display values using 2 displays, I'm using this code, originally from another post from this forum but I'll never be able to display values on the second display.
The schematic seems to be ok but, I only get the message on PORTA.0,
never on PORTA.1, display 2.
I suspect that the problem can be in the define area but I don't know where, can anyone help?
Thank you
Eduardo Freitas
'=================================================
'Chip model
#chip 16F628A, 4
#config OSC = XT, WDT = OFF
#define StartUpDelay 10 ms
'setting the 7 segment display with 2 displays
#define displaycount 2
#define DisplayPortA PORTB
#define DisplayPortB PORTB
#define DispSelectA set PORTA.0 ON set PORTA.1 OFF
#define DispSelectB set PORTA.0 OFF set PORTA.1 ON
dir PORTB.0 out
dir PORTB.1 out
dir PORTB.2 out
dir PORTB.3 out
dir PORTB.4 out
dir PORTB.5 out
dir PORTB.6 out
dir PORTB.7 out
dir PORTA.0 out
dir PORTA.1 out
Startup:
Wait StartUpDelay
'================================================================
'===== MAIN PROGRAM LOOP
'================================================================
Dim Message(10)
Message() = "Hello "
Main:
for DispMessage = 1 to 6
DisplayChar 1, Message(DispMessage)
wait 25 10ms
DisplayChar 2, Message(DispMessage)
wait 25 10ms
next
Goto Main
I think multiplexing will take a little more work on the definition side, plus doubtful about trying to string two consecutive conditions after a definition. Not real sure on how the DispSelectA/B/C/D relationship works, maybe best to manually set the displays on and off. Also, don't see where DisplayCount comes into play with the 7segment.h file.
Try the following:
...
...
...
#define DispSelectA nop
#define DispSelectB nop
#define Display1 PortA.0
#define Display2 PortA.1
#define waitDisplay wait 12 ms
...
...
...
for DispMessage = 1 to 6
Set Display2 OFF:Set Display1 ON
DisplayChar 1, Message(DispMessage)
waitDisplay
Set Display1 OFF:Set Display2 ON
DisplayChar 2, Message(DispMessage)
waitDisplay
next
goto Main
Thank you,
Your sugestion work ok. for now is enough, now I can multiplex a number for a lot of situation. I'll try with four.
E.Freitas