I have been studying the tutorial for the 8051 at http://www.8052.com. For starters, I am writing a simple assembler code for an AT89S8253 microcontroller which will read inputs on Port1 and output it to Port3. I am using the demo C51 software from KEIL and am also using the AT89ISP cable to download the hex file onto my device. I am running the XTAL1 input at 4 MHz and have the device setup on a Teradyne J750 tester. I wrote a simple program, but I am getting timer or clock-like outputs from Port2. I am not sure how to proceed (whether I need an include file, the correct syntax, etc.). Also, can you recommend good references (books, websites)? I am new at this, so I would really appreciate the help.
Thank you all for your immediate responses. I am utilizing MicroVision3 V3.50. The program compiles without any errors. I can select the AT89S8253 from the "select device for target menu." When I run the part on the emulator, I can change the pin values on Port1 and observe the corresponding changes on Port3. If the pins are toggling this way on the emulator, shouldn't I be able to observe these physical changes on the outputs for Port3?
Some of things that I noticed on peripherals were:
1. When I set bit 5 to low on Port1, the Timer/Counter1 peripheral T1 Pin box becomes unchecked.
2. Setting bit 4 to low on Port1, also unchecks the T0 Pin box on the Timer/Counter0 peripheral and also unchecks the SS# Pin on the SPI peripheral
3. Setting bit 3 to low on Port1, unchecks the INT1# box on the Timer/Counter1 peripheral
4. Setting bit 2 to low on Port1, unchecks the INT0# box on the Timer/Counter0 peripheral, checks the IE0 box on the Interrupt System menu, and changes the Req from 0 to 1 for the P3.2/Int0 Int Source on the Interrupt System menu also.
default clock settings are: XTAL Frequency = 24,000,000 CPU Clock = 2,000,000
When I start the debug session I get the following message:
"EVALUATION VERSION Running with Code size Limit: 2K"
The Teradyne J750 digital tester that I am utilizing, allows me to stimulate and debug the device. I can input certain settings such as:
VCC input voltages load currents timing equations
Here is the code that I obtained from an example:
sfr P1 = 0x90; /* SFR definition for Port 1 */ sfr P3 = 0xB0; /* SFR definition for Port 3 */ /*------------------------------------------------ MAIN C Function ------------------------------------------------*/ void main (void) { unsigned char pval; /* temp variable for port values */ P1 = 0xFF; /* Setup P1 for Input */ /*-------------------------------------- Use the Toolbox buttons in the debugger to change the value of P1. Open the Port 1 and Port 3 dialogs from the Peripherals Menu to view their status. --------------------------------------*/ while (1) { pval = P1; /* Read P1 into pval */ P3 = pval; /* Write pval to P3 */ } }
The code is obviously in C and not assembler, my apologies. I have been looking over examples that utilize both types.