PDA

View Full Version : Pokeb FUNCTION is not working for me


Philip
11-22-07, 09:52 AM
When I execute the code below, I expect
Port 4 pins to give me o volt, when check
with my volt meter. However either with
the code or not port 4 pin 5,6,7 reads 4.16 volt
whilst the port 4 pin 0,1,2,3,4 reads 0 volt.

How should the look like to have all the pins at
ground. How should it look like to have all the high

#include clib\common51.c
#include clib\syslib51.c
#include clib\peekpoke.c

main()
{
pokeb(0xF8,0x0);
}


As for port five all the pins reads high (4.16 volts)

Please help toogle this pins on and off.

Thanks

RMDumse
11-25-07, 12:51 PM
Philip, it is the holiday week end here. Thanksgiving. (I'm not sure where in the world you are, and if it is a holiday there.) So I don't have any 8051 documentation here at home. But. Here's what I am wondering. Does the port have a data direction register? Usually micros do. If the ports are still configured as inputs, then they will not output anything but "1"s. Perhaps you could look into the documentation to see if there aren't examples of port manipulation, and if they set up a data direction register first. Also look to see if there are special functions associated with the pins you are using the SFR (Special Function Registers) may assign particular purposes to pins, so they may not act like regular I/O.

Also I am confused by your choice of "Port 4". The regular 8031 board we sell has only ports 0,1,2,3. Which board are you using?

Philip
11-27-07, 03:27 AM
I am confused by your choice of "Port 4". The regular 8031 board we sell has only ports 0,1,2,3. Which board are you using?

Am using NMIX0016

nmitech
11-27-07, 01:23 PM
main()
{
pokeb(0xF8,0x0);
}


You are writing zero's to Port 5, not Port 4. Port 4 address is 0xE8. See manual link below on page 17 & 18.
http://www.newmicros.com/store/product_manual/nmix-0016-oem.html


However either with the code or not port 4 pin 5,6,7 reads 4.16 volt
whilst the port 4 pin 0,1,2,3,4 reads 0 volt.
Port 4 bit 0 through 4 are dedicated for the keypad decoder as inputs. If your application does not use keypad. Remove the IC, 74C923 you can use entire 8-bit as GPIO's. Port 5 is always available for GPIO's.