Found the answer by searching the hard way. The command is set up for common cathode.
To go common anode, use:
For values up to 255 I believe you could use the NOT command, (e.g. value = NOT value), then send it to the the display. At first glance, a word value will not work?
If you need to send out a serial word, say to a cascadable 74HC595 serial 8 bit latch, then an invert word sub program like below might work. As noted in previous posts, you need to break the word down LSByte first, and same on reassembling.
One must be careful if negative numbers are to be displayed, as in a temperature reading. Then a two's complement or increment of the LSByte must be performed also.
InvertWord(InvertW)
InvertWLow = InvertW 'Split word into bytes so byte size
InvertWHigh = InvertW_H 'assembler operations can be used
comf InvertWLow 'Invert Low byte bits in the Register
'incf OWTempL 'Add One to Low byte to turn into 2's compliment
comf InvertWHigh 'Invert High byte bits
InvertW = InvertWLow 'Reassemble bytes back into word
InvertW_H = InvertWHigh
End Sub
Note: The incf is for two's compliment only
Chay
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The search function is in the forum drop down menu when scrolled over. A ticket has been opened with sourceforge.net for a "request for enhancement". The sourceforge.net first level support has acknowledged he has been pinged on this lately, and suspect the request has been sent up the ladder. The idea is to get the search box back in plain view, the way it used to be, before the recent website makeover.
Here's a thought on modifying the 7segment.h include file for common anode displays. Perhaps a little less confusing than my previous post?
During code initialization make use of the compilers pre-processor by using the #define statement:
#define 7segment ComAnode
Then in 7sement.h modify the DisplayValue and DisplayChar subs. There will be four PortX instances (A, B, C, and D) for each sub. So starting with the first display in the DisplayValue sub, it would be modified like so:
;OLD
DisplayPortA = DispTemp
Hi all. Do these commands expect a common anode display to be hooked up, or common anode?
Is there a way to invert the output from sink to source, for example?
Is there a way to search this forum so i don't waste people's time answering 'the same old' questions?
Thanks,
Chay
Found the answer by searching the hard way. The command is set up for common cathode.
To go common anode, use:
For values up to 255 I believe you could use the NOT command, (e.g. value = NOT value), then send it to the the display. At first glance, a word value will not work?
If you need to send out a serial word, say to a cascadable 74HC595 serial 8 bit latch, then an invert word sub program like below might work. As noted in previous posts, you need to break the word down LSByte first, and same on reassembling.
One must be careful if negative numbers are to be displayed, as in a temperature reading. Then a two's complement or increment of the LSByte must be performed also.
The multiple led and seven segment issues have been discussed a lot over at http://www.electro-tech-online.com/micro-controllers/
Kent
InvertWord(InvertW)
InvertWLow = InvertW 'Split word into bytes so byte size
InvertWHigh = InvertW_H 'assembler operations can be used
comf InvertWLow 'Invert Low byte bits in the Register
'incf OWTempL 'Add One to Low byte to turn into 2's compliment
comf InvertWHigh 'Invert High byte bits
InvertW = InvertWLow 'Reassemble bytes back into word
InvertW_H = InvertWHigh
End Sub
Note: The incf is for two's compliment only
Chay
The search function is in the forum drop down menu when scrolled over. A ticket has been opened with sourceforge.net for a "request for enhancement". The sourceforge.net first level support has acknowledged he has been pinged on this lately, and suspect the request has been sent up the ladder. The idea is to get the search box back in plain view, the way it used to be, before the recent website makeover.
Here's a thought on modifying the 7segment.h include file for common anode displays. Perhaps a little less confusing than my previous post?
During code initialization make use of the compilers pre-processor by using the #define statement:
#define 7segment ComAnode
Then in 7sement.h modify the DisplayValue and DisplayChar subs. There will be four PortX instances (A, B, C, and D) for each sub. So starting with the first display in the DisplayValue sub, it would be modified like so:
;OLD
DisplayPortA = DispTemp
;NEW
#IFNDEF 7segment ComAnode
DisplayPortA = DispTemp
#ENDIF
#IFDEF 7segment ComAnode
DisplayPortA = !DispTemp
#ENDIF
And so on down the line.
Save the file, and should be good to go.
Thanks for the search info...very useful.
I have common cathode displays, therefore I'm set. But it's good to know it can be made to work if I drop into a bunch of cheap common anodes.
Chay
I have done this, and added 7segment ComAnode to my constants, but it still sends negative pins HIGH. Any help?
I think this can be simplified to just one define and two statements, if an old 7segment.h file is to be believed.
In program before Main, use: #def CommonAnode
In 7segment.h file from the include/lowlevel folder, insert two statements as follows and save it (Ctrl+S):
1. In the DisplayValue() sub insert #ifdef CommonAnode lines:
if DispChar = 9 then DispTemp = 103 '***************************** #ifdef CommonAnode DispTemp = !DispTemp #endif '***************************** 'Select display and show integer2. In the DispChar() sub insert #ifdef CommonAnode lines:
if DispChar = 90 then DispTemp = 27 'Z ShowChar: '***************************** #ifdef CommonAnode DispTemp = !DispTemp #endif '***************************** 'Select display and show integer