Advantages of HSerout over Serout2 and a problem


Results 1 to 6 of 6

Threaded View

  1. #3
    rpstroj's Avatar
    rpstroj Guest


    Did you find this post helpful? Yes | No

    Default

    That's what I thought the 'h' was. I was looking at the hex incorrectly. Anyway, here's the part of my code concerning hserout if anyone can help with my other problems:



    INCLUDE "modedefs.bas" 'Contains mode definitions for

    DEFINE OSC 12 ' Define OSC 12Mhz for HS

    DEFINE HSER_RCSTA 90H ' Enable Hardware USART receive
    DEFINE HSER_TXSTA 24H ' Set Hardware USART parameters
    DEFINE HSER_BAUD 9600 ' Set baud rate to 9600
    DEFINE HSER_CLROERR 1


    TRISA = %11111111
    TRISB = %00001110
    TRISC = %00000000

    ADCON1=2 'Set PORTA to Analog

    'Variables for LCD
    clrSCR CON 12 ' Cntl-L: clear the display.
    posCmd CON 16 ' Position the cursor.
    ESC CON 27 ' Escape code.
    noCurs CON 4 ' no cursor shown

    Q0 VAR BYTE
    adcount VAR WORD
    LCD VAR PORTB.4

    'serout2 defined as 16468=>9600 baud
    '16416=>19200 baud
    '16390=>38400 baud
    Loop:

    Low PORTB.0 'Start conversion
    High PORTB.0 'bring it back to high

    notdone:
    IF PORTB.1=0 Then notdone

    ShiftIn PORTB.3, PORTB.2, 2, [adcount\16]

    IF adcount<10 Then
    HSerout ["0000", DEC adcount, ","]
    'SerOut2 LCD, 16390, ["0000", DEC adcount, ","]
    Pause 500
    GoTo Loop
    EndIF

    IF adcount<100 Then
    HSerout ["000", DEC adcount, ","]
    'SerOut2 LCD, 16390, ["000", DEC adcount, ","]
    Pause 500
    GoTo Loop
    EndIF

    IF adcount<1000 Then
    HSerout ["00", DEC adcount, ","]
    'SerOut2 LCD, 16390, ["00", DEC adcount, ","]
    Pause 500
    GoTo Loop
    EndIF

    IF adcount<10000 Then
    HSerout ["0", DEC adcount, ","]
    'SerOut2 LCD, 16390, ["0", DEC adcount, ","]
    Pause 500
    GoTo loop
    EndIF

    HSerOut [DEC adcount, ","]
    Pause 500

    GoTo Loop

    End
    Last edited by rpstroj; - 11th August 2004 at 21:13.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts