|
|
View previous topic :: View next topic |
Author |
Message |
pfaerber Guest
|
Error by input_b |
Posted: Thu Jan 09, 2003 5:17 am |
|
|
Wenn I use this Programm
void main()
{
int idummy;
port_b_pullups(FALSE);
set_tris_b(0xf8);
output_bit(PIN_B0,FALSE);
output_bit(PIN_B1,FALSE);
output_bit(PIN_B2,FALSE);
while (TRUE)
{
idummy = input_b();
} // while
} // main
all is fine. Wenn I change the port_b_pullups line to True
the outputs switch to high.
Is this OK ??? (why)
___________________________
This message was ported from CCS's old forum
Original Post ID: 10556 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Error by input_b |
Posted: Thu Jan 09, 2003 12:45 pm |
|
|
:=all is fine. Wenn I change the port_b_pullups line to True
:=the outputs switch to high.
:=Is this OK ??? (why)
--------------------------------------------------------
Make sure your #fuses statement has NOLVP at the end.
See the example below:
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,PUT,BROWNOUT, NOLVP
#use Delay(clock=8000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
I'm not certain that this will solve your problem,
but I think it's possible.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10570 |
|
|
pfaerber Guest
|
Re: Error by input_b |
Posted: Fri Jan 10, 2003 3:41 am |
|
|
:=:=all is fine. Wenn I change the port_b_pullups line to True
:=:=the outputs switch to high.
:=:=Is this OK ??? (why)
:=--------------------------------------------------------
:=
:=Make sure your #fuses statement has NOLVP at the end.
:=See the example below:
:=
:=#include <16F877.h>
:=#fuses HS,NOWDT,NOPROTECT,PUT,BROWNOUT, NOLVP
:=#use Delay(clock=8000000)
:=#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
:=
:=I'm not certain that this will solve your problem,
:=but I think it's possible.
I have NOLVP in the config
#include <16F876.h>
#device *=16
#use delay(clock=4000000,RESTART_WDT)
#fuses XT,NOWDT,PUT,BROWNOUT,NOPROTECT,NOLVP
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7)
___________________________
This message was ported from CCS's old forum
Original Post ID: 10588 |
|
|
Tomi Guest
|
Re: Error by input_b |
Posted: Fri Jan 10, 2003 4:16 am |
|
|
Yes, because input_x() sets the tris register to input ALL the pins.
If you want to use input_b() but pin0-2 output use this line:
#use FIXED_IO(port_outputs = pin_b0,pin_b1,pin_b2)
After this, the input_b() function sets TRIS_B to 0xF8 instead of 0xFF.
:=Wenn I use this Programm
:=
:=void main()
:={
:= int idummy;
:=
:= port_b_pullups(FALSE);
:= set_tris_b(0xf8);
:= output_bit(PIN_B0,FALSE);
:= output_bit(PIN_B1,FALSE);
:= output_bit(PIN_B2,FALSE);
:=
:=
:= while (TRUE)
:= {
:= idummy = input_b();
:= } // while
:=} // main
:=
:=all is fine. Wenn I change the port_b_pullups line to True
:=the outputs switch to high.
:=Is this OK ??? (why)
___________________________
This message was ported from CCS's old forum
Original Post ID: 10590 |
|
|
pfaerber Guest
|
Re: Error by input_b |
Posted: Fri Jan 10, 2003 5:00 am |
|
|
:=:=all is fine. Wenn I change the port_b_pullups line to True
:=:=the outputs switch to high.
:=:=Is this OK ??? (why)
:=--------------------------------------------------------
:=
:=Make sure your #fuses statement has NOLVP at the end.
:=See the example below:
:=
:=#include <16F877.h>
:=#fuses HS,NOWDT,NOPROTECT,PUT,BROWNOUT, NOLVP
:=#use Delay(clock=8000000)
:=#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
:=
:=I'm not certain that this will solve your problem,
:=but I think it's possible.
I have the NOLVP statement :-(
#include <16F876.h>
#device *=16
#use delay(clock=4000000,RESTART_WDT)
#fuses XT,NOWDT,PUT,BROWNOUT,NOPROTECT,NOLVP
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7)
___________________________
This message was ported from CCS's old forum
Original Post ID: 10591 |
|
|
pfaerber Guest
|
Re: Error by input_b |
Posted: Fri Jan 10, 2003 5:24 am |
|
|
:=Yes, because input_x() sets the tris register to input ALL the pins.
:=If you want to use input_b() but pin0-2 output use this line:
:=#use FIXED_IO(port_outputs = pin_b0,pin_b1,pin_b2)
:=
:=After this, the input_b() function sets TRIS_B to 0xF8 instead of 0xFF.
Yes it works.
the old input
.................... idummy = input_b();
0026: MOVLW FF
0027: BSF 03.5
0028: MOVWF 06
0029: BCF 03.5
002A: MOVF 06,W
002B: MOVWF 21
the new input
.................... idummy = input_b();
0029: MOVLW F8
002A: BSF 03.5
002B: MOVWF 06
002C: BCF 03.5
002D: MOVF 06,W
002E: MOVWF 21
Thank you for your reply. Now it works fine.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10592 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|