TA Hints for Lab #1

Software :

1)     Initialize and configure the ports( input/output), e.g. PORTA, PORTB as needed. For PORTA, use the code that is given in the datasheet.
2)     Make sure that before you access a register, you are in the appropriate bank.

Setup for serial communication:
3)     Set up the Baud rate = 9600 for 4 MHz clock and load it onto the appropriate special  function register(remember lecture on Lab 1).
4)     Select the baud rate high/low speed option.
5)     Enable transmission/reception. (But no interruption in this assignment)

Serial Transmission (Send Prompt) :
6)     Send the first character of prompt to terminal, check if the transmit buffer is empty, wait until it is empty, then transmit the next character. Repeat until the whole prompt has been transmitted.
        Remember: data should be in the ASCII format. Please refer:    http://www.asciitable.com

Serial Reception (Check Response):
7)     Check whethere the data has been received, if not, wait until new data is received.
8)     Remember, data received is in the ASCII format. Convert it to the appropriate format.
9)     Check the value keyed at prompt (where is it stored ??).  If "Y", goto Step 10.  If not "Y", resend the prompt (Step 6).

Echo PORTA:
10)    Now echo PORTA to PORTB, and send the message “Value [HEX] set in LEDs” to terminal.

Serial Reception :
11)    Check if  the data has been received,  if not, goto 12,  if yes, compare the input setting on the DIP switch( content of what port ?) and the value keyed in( where is it stored ??) . Send a message to the terminal based on the result of comparison.

Check PORTA:
12)    Check whether PORTA has updated, if no, goto 11, if yes, goto 10.

Hardware :

1)     Program the PIC16f877 part based on what you did during the Intro Lab.

2)     Remove the programmed PIC16f877 and associated pod (carefully!!) from the ICD demo board and plug it on the breadboard. The download cable should still be attached to it.

3)     Attach the usual connections like Vdd, GND, oscillator etc. to the PIC16f877 with the aid of the pin diagram given in the datasheet.
        For Oscillator:

4)     Check to see if the oscillator generates a 4MHz clock using the oscilloscope.

5)     Plug in the DIP switch and connect it to PORTB of PIC16f877.  If a switch is ON, the corresponding bit of PORTB should read a 1.

6)     Plug in the LEDs across PORTA. You will need only 4 LEDs (Why?).

7)     Read the SP233ACP datasheet and correlate that with MAX232.  The figure given in the book for serial interface uses MAX232, but for the lab, SP233ACP will be used.

8)     Connect SP233A and PIC16f877 accordingly.

9)     Read the data sheet for 25-pin D connector and identify the receive/transmit pins.
        Please refer:   http://www.airborn.com.au/rs232.html

10)   Connect the corresponding outputs from SP233ACP to the 25 pin connector, whose other end is connected to VT-220.

11)   Before switching on the power supply to the breadboard and VT-220, make doubly sure that all the Vdd  and GND pins of all chips are indeed connected to Vdd and GND.

12)   Make sure your terminal works at 9600bps. (The default value is 19200)

12)   See if it works!! Else Start DEBUGGING.

13)   Please dont use all your strength for plugging and unplugging the pod adapter and ICs into the boards. Handle them gently.