Ça, c'est la phrase qui tue :-)Well it's actually pretty simple once you know how.
I wish this could be as simple as it looks like... to your (expert) eyes.
Going to sleep now but tomorrow, MELABS will have to be nice with me!
Bonne nuit.
Ça, c'est la phrase qui tue :-)Well it's actually pretty simple once you know how.
I wish this could be as simple as it looks like... to your (expert) eyes.
Going to sleep now but tomorrow, MELABS will have to be nice with me!
Bonne nuit.
Roger
MELABS or MPLAB?
Bonne nuit![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Update to the VSM... painful and useless as you can't create your OWN neither modify the provided sample...
Idiot and useless...
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I might have misread the original intent, but you did ask:
"Under the hood" PBP will either write to the port as a Byte, or set/clear individual bits. This means you have 2 basic approaches:How is it possible to handle ONLY those four bits wihtout modifying the other (MSB) four bits?
1) Dave's approach, which deals with the port as a byte. This uses some bit manipulation to preserve the status of the MSBs.
2) And what I was trying to get at, but was not very clear, and that is to set each bit individually.
Just so I've got it straight, as your FOR...NEXT loop counts from 0 to 3 you would like to see a pattern on PORTAs LSB like: 0001, 0010, 0100, 1000. Is this correct?
If this is the case, then this should work:
SteveBCode:Digit VAR Byte DCD_temp VAR Byte FOR Digit = 0 TO 3 DCD_temp = DCD Digit PORTA.0 = DCD_temp.0 PORTA.1 = DCD_temp.1 PORTA.2 = DCD_temp.2 PORTA.3 = DCD_temp.3 NEXT Digit
Last edited by SteveB; - 26th February 2007 at 05:53.
hi all
i m new to pic16f877a.i need a help regarding timers in pic 16f877a.
in the timer1,T1CON register what is the purpose of using T1OSCEN bit and the T1SYNC bit.if we are using T1SYNC bit,with what signal it will get synchronised and the purpose of synchronization.expecting the reply.
thanx n advance
nish
I was already sleeping when I wrote this big mistake.
Thanks SteveB; indexing the ports, like "PORTA.0[Var]", works well. But you're right, it is about to adress the four LSBs.
Roger
If the upper four bytes are guaranteed to always be inputs then you do not need to worry about how “they” are affected by your modifications of the lower four output bytes. Your
should work fine (all reads are of the actual values of the pins irrespective of any previous written values; all writes are read-modify-write operations).Code:PORTA = ~DCD digit
If the upper four bits could be outputs then you do need to worry and you can use one of the suggested fixes. If speed is an issue as you suggest (but I do not see why it would be, especially with a pause in the main loop), then you could 1) switch to real interrupts (see Darrel's methods) and 2) unroll your for-next loop. A possible version is shown below for the latter.
Code:' PORTA = XXXX1111 value_d = value dig 3 'Select the 3 Digit Value lookup value_d, [$7E,$0C,$B6,$9E,$CC,$DA,$FA,$0E,$FE,$DE], Segments PORTA = PORTA - 8 ' PORTA = XXXX0111 PORTB = Segments pause Scan MAIN: value_d = value dig 0 'Select the 0 Digit Value lookup value_d, [$7E,$0C,$B6,$9E,$CC,$DA,$FA,$0E,$FE,$DE], Segments PORTA = PORTA +7 ' PORTA = XXXX1110 PORTB = Segments pause Scan value_d = value dig 1 'Select the 1 Digit Value lookup value_d, [$7E,$0C,$B6,$9E,$CC,$DA,$FA,$0E,$FE,$DE], Segments PORTA = PORTA - 1 ' PORTA = XXXX1101 PORTB = Segments pause Scan value_d = value dig 2 'Select the 2 Digit Value lookup value_d, [$7E,$0C,$B6,$9E,$CC,$DA,$FA,$0E,$FE,$DE], Segments PORTA = PORTA - 2 ' PORTA = XXXX1011 PORTB = Segments pause Scan value_d = value dig 3 'Select the 3 Digit Value lookup value_d, [$7E,$0C,$B6,$9E,$CC,$DA,$FA,$0E,$FE,$DE], Segments PORTA = PORTA - 4 ' PORTA = XXXX0111 PORTB = Segments pause Scan Goto MAIN
and for clarity – any change to a single pin in PBP actually is writing to the entire port. (i.e, if you do this PORTA.0=1 then the microprocessor does this PORTA = uuuuuuu1 where the u is the value of the port pin at the time of the execution of the command)
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks