You didn't manage to attach the file, however, this is a common problem. The important thing is that this is not an error message, it is a warning and as such does not stop your file from assembling/compiling. You can get rid of this annoying warning with the following line,
Code:
errorlevel -302
This is of course assuming that you have switched banks before the error line.
thanks for ur message. the thing is tho, when i watch the values in the watch window, i cant even see the values being moved into TRISA and TRISB from the accumilator, w.
and for exmaple, when i run the program on xp, it comes up as an error but it still buildsl the file, when i run it on vista, it comes up as error but doesnt build at all.
anyway i have attathed files as txt, i hope they work, mayb then u can see anything i am missing. thank you
Why would you set TX to be an input?, it needs to be an output surely? - it's possible that setting it as TX overrides TRIS?, but in any case it still makes more sense to set it as an output.
well yes, you are sending data OUT from it, so why would it be an input? do you think if i used an older version of mplab it will sort this out? am i changing the bank pages properly in my code??
Why would you set TX to be an input?, it needs to be an output surely? - it's possible that setting it as TX overrides TRIS?, but in any case it still makes more sense to set it as an output.
Bit SPEN (RCSTA<7>) and bits TRISB<2:1> have to be set in order to configure pins RB2/TX/CK and RB1/RX/DT as the Universal Synchronous Asynchronous Receiver Transmitter.
I suspect that means they have to be set correctly - not 'set' as opposed to 'cleared'
Here's the similar line for the 876/7 datasheet.
Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to
be set in order to configure pins RC6/TX/CK and
RC7/RX/DT as the Universal Synchronous Asynchronous
Receiver Transmitter.
Really? The E-USART is quite different. When you set the SPEN bit, the RX/TX pins should be configured automatically regardless of the TRIS bits (see notes on page 151/4). I will try that on next days.
Edit: cyprio7, I too can see the content of the registers with MPLAB SIM and WinXp.
Your program is not terminated properly. Add a goto $ instruction before the end directive.
It doesn't really matter in this case as the OP had RB2 set and so had the TX pin as input and the RX pin as output. However, the data sheet on the 16F628 is specific and states both TX and RX should be input. As to the 16F886, I may have a bug there.
From the attached code,
Code:
movlw b'00000100' ; RB2(TX)=1 others are 0
movwf PORTB
It specifically mentioned that "The correct setting of the TRIS bit is 0".
The TRIS setting for the TX pin on PORTC in
Table 9-5 of the Device Data Sheet was incorrectly
stated as ‘1’.
The correct TRIS setting for the TX pin on PORTC
is ‘0’.
Looking at the block diagram for the 16F628A, RB1/2 port, the output of the TRIS latch is ANDed with a 'Peripheral OE' enable signal and this controls the output buffer. (Figures 5.9/10 in the datasheet)
Therefore if the peripheral is enabled, the state of the TRIS latch is irrelevant since the output buffer is controlled by the Peripheral output enable.
Looking at the block diagram for RC6/7 on the 16F866 shows that the output buffer is controlled only by the TRIS latch, so it would need setting correctly to use the EUSART. On the 16F88, some I/O pins have additional logic to force the state of the output buffer when a peripheral is in use, others don't.
It would appear that the requirement to set the TRIS latch to input or output when using the I/O pin with a peripheral would depend on the specific PIC and peripheral being used. A quick look at the port block diagram schematic will reveal all (assuming the datasheet is correct).