Loading ...
Sorry, an error occurred while loading the content.

Re: [cosmacelf] 1854

Expand Messages
  • jplagasse@jparchives.com
    ... I have a few. ... Here is something i dug up from the 1802 based 1010 PVT software. We still rent these units out in the Canadian Alberta Oilpatch.
    Message 1 of 2 , Jul 30, 2004
    • 0 Attachment
      >Does anyone have some example routines for driving
      >and 1854 UART? Also if anyone has an interest in >some
      I have a few.
      >Elliott

      Here is something i dug up from the 1802 based "1010
      PVT" software. We still rent these units out in the
      Canadian Alberta Oilpatch.
      Written for the Avocet 1802 assembler... the
      declarations are not included but i could dig these up
      if useful or required.

      Hope this helps... i hope the format is readable after
      posting.

      Pierre Lagasse



      ;*************************************************************************
      ;
      ;Uart O/P to recorders subroutine
      ;On entry: set RD for first location of series of ram
      locations to send.
      ;Set Lo R8 with number of bytes to send. 01 minimum.
      ;Low R7 is checksum & D on return
      ;

      UARTOUT

      SEX RD
      LDI 00H
      PHI R8 ;clear top of byte
      count reg. (max 255 low)
      CONSUB BN2 CONSUB ;wait till uart ready
      GLO R7 ;get checksum
      ADD ;checksum add: M(R(X))
      + D -> D
      OUT2 ;Uart O/P: M(R(X))
      -> bus; R(X) + 1
      DEC R8 ;decrement byte count
      reg.
      PLO R7 ;store D (checksum)
      GLO R8 ;test byte counter
      LBZ EndUOP ;if zero, exit
      GLO R7 ;restore checksum in D
      reg.
      LBR CONSUB ;begin again

      EndUOP GLO R7 ;restore checksum in D
      reg.

      RETURN
      ;
      ;*******************************************************************
      ;Uart O/P's a single char to uart subroutine
      ;On entry: Low R7 has char to send
      ;

      UARTchr PROC

      SEX R2 ;point X to stack
      GHI R7 ;Byte to send from
      calling program
      STR R2 ;store D to stack
      ..CONSUB
      BN2 ..CONSUB ;wait till uart ready
      OUT2 ;send checksum to
      serial port
      DEC R2 ;OUT2 increments X -
      (DEC restores X) (stack)
      SEX R3 ;precautionary....
      point X away from stack.

      RETURN
      UARTchr ENDPROC

      ;-------------------------------------------------------


      ;*******************************************************************
      ;
      ; UART O/P TO RECORDERS
      UARTOP SEX R3
      DIS ;disable interrupts
      DB 33H
      OUTPORT 1, 01H ;SELECT UART
      OUTPORT 3, 00H, 1CH, 9CH ;CONFIGURE UART
      SET TR BIT
      ;00011100
      ;x
      Transmit request
      ; x
      Transmit break
      ; x
      Interrupt enable
      ; x WLS2
      ; x WLS1
      11 = 8 data bits
      ; x SBS
      1 = 2 stop bits
      ; x EPE
      0 = odd parity
      ; x PI
      0 = parity enabled
      LDI #00H ;clear checksum register
      ;following ADD commands
      generate checksum in D
      PLO R7 ;Store initial checksum
      SEX RD
      ;
      PUTREG TRPREC,, RD ;beginning location of
      5 byte string
      PUTREG 05H, LO, R8 ;count reg set to 5
      bytes
      GOSUB UARTOUT ;checksum in D on return
      ;TRIP
      ;Pits
      ;FLOW
      ;AUX O/P (pump, L/G
      inc, Trip vol)
      ;Alarm & Alarm light

      PUTREG VOLOUT,, RD
      PUTREG 02H, LO, R8
      GOSUB UARTOUT
      ;Trip Vol out MSB (M3)
      ;Trip Vol out LSB
      ;... and so on.
    Your message has been successfully submitted and would be delivered to recipients shortly.