Hello,
 
i want to establesh a connection between the 16F84 and the RS232 port at my computer. The code i use is from the application notes from techtools Chapter 3, but they are talking about the 16c54 in the example is there a difference for this usage?
Also i'm using a the max232 as shown in the example, but all there is is rubish at my screen (good old term95). Is there somebody who did manage to get the pic talking to the RS232? I'm using the CVASM16 assambler. It's not the computer cause the Universal Infrared Remotecontrol works great on the same port.
Here the code..thanks for your reaction in advance!
(i'm using a 4mc christal)
Aart.
 
 
PROGRAM: XMIT232.SRC
; Taken from Parallax PIC Applicaton Note: Sending RS-232 Serial Data
; Written     July 15, 1993
; Revised February 24, 1996
 
; This program transmits a string of serial data. The baud rate is determined
; by the value of the constant bit_K and the clock speed of the PIC. See the
; table in the application note (above) for values of bit_K. For example, with
; the clock running at 4 MHz and a desired transmitting rate of 4800 baud,
; make bit_K 50.
 
; >>> Remember to change device info if programming a different PIC! <<<
; Do not use RC devices. Their clock speed is not sufficiently accurate
; or stable enough for serial communication.
 
device pic16f84,xt_osc,wdt_off,protect_off   ; changed the procesor type from 16c54
                                                               ; into 16f84
  
bit_K  = 24                                               ;24 for 9600-baud operation @ 4 MHz
serial_out = ra.2                                        ;Output naar pin 1 van IC
org     8                                                    ;Start of available RAM
delay_cntr ds 1                                         ;Counter for serial delay routines
bit_cntr ds 1                                              ;Number of transmitted bits
msg_cntr ds 1                                           ;Offset in string
xmt_byte ds 1                                           ;The transmitted byte
org     0                                                     ;Start of code space (ROM)
jmp begin                                                  ;Start Programma.
 
begin  mov !ra, #00000000b                        ;Set port to output.
mov msg_cntr, #0                                      ;Message string has nine characters;
                                                                ;0 through 8.
:again  mov bit_cntr,#8                               ;Eight bits in a byte.
           mov w,msg_cntr                             ;Point to position in the string.
           call string                                      ;Get the next character from string. 
           mov xmt_byte,w                             ;Put character into the transmit byte.
 
           clrb serial_out                                 ;Change to setb serial_out for direct
                                                                ;connection.
 
           call bit_delay ;Start bit.
 
:xmit    rr xmt_byte                                    ;Rotate right moves data bits into
                                                                ;carry, starting with bit 0.
 
           movb serial_out,c                           ;Change to movb serial_out,/c for
                                                               ;direct connection.
 
           call bit_delay                                 ;Data bit. 
           djnz bit_cntr,:xmit                          ;Not eight bits yet? Send next data bit
 
           setb serial_out                               ;Change to clrb serial_out for direct
                                                               ;connection
 
          call bit_delay                                   ;Stop bit.
          inc msg_cntr                                   ;Add one to the string pointer.
 
          cjbe msg_cntr,#8,:again
                                                                ;More characters to send? Go to the top
 
:endless jmp :endless                                ;Endless loop. Reset controller to run
                                                                ;program.
 
; To change the baud rate, substitute a new value for bit_K at the beginning of
; this program.
 
         bit_delay mov delay_cntr,#bit_K
:loop  nop
         djnz delay_cntr, :loop
         ret
 
         string  jmp pc+w                              ;String consisting of "Parallax"
                                                               ;followed by a linefeed.
 
         retw 'P','a','r','a','l','l','a','x',10