HELP!!! OSD Hserout problem??


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322

    Default HELP!!! OSD Hserout problem??

    Hi All!
    It has been some time since I have worked with PIC's and have forgotten too much! To add to everything I am now running Windows 7 64 bit so many things are a big struggle. I was able to score the code for using an STV5730 and when I try to compile it, the compiler complains about Hserout and also the use of "[" and "]". Multiple "syntax error" and "Expected "]" or ")". Could really use some help and understanding.

    Thanks, Ed

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,519


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    The manual tells you how HSEROUT works, that's about all I can say since you're not showing the code you're having problems with.

  3. #3
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    I forgot to upload the code!!! Sorry. You have always been one of the greatest and most knowledgeable people I have ever met. I usually try many different things first before posting any questions and it is only when I become tired and frustrated with the failures I turn to the forum and people like you. Thank you!

    Ed
    Attached Files Attached Files

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    I feel very uncomfortable opening an attachment in that format , it could contain any amount of malware or nasty macros.
    plain text please
    Warning I'm not a teacher

  5. #5
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    Quote Originally Posted by richard View Post
    I feel very uncomfortable opening an attachment in that format , it could contain any amount of malware or nasty macros.
    plain text please
    I agree,

    Ramius, copy the code and then paste it between code] [/code tags (with square brackets at either end)

  6. #6
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    Okay, sorry, thought it was too much to put in a message. i would never send an infected file and I spend a lot of time and money to make certain my machine is clean. What is confusing to me is EVERY Hserout statement shows up as a syntax error with the next line of the error saying it expected a "]" or ")"! It does not seem to like the right bracket and there are no errors for the left bracket starting at line 171. It seems to only be the Hserout statements with "CS" in them. Here is the code, thanks for looking at it!

    '************************************************* ***************
    '* Name : Overlay.BAS *
    '* Author : [Grant Taylor VE3XTV / ZL1WTT] *
    '* Notice : Copyright (c) 2010 *
    '* : All Rights Reserved *
    '* Date : Start date 30/12/2010 *
    '* Version : 6.0 *
    '* Notes : onging project *
    '* : *
    '************************************************* ***************
    ' Using STV5730A as a video overlay for text information
    ' With a PIC16F876A or the PIC18F252 Microcontroller
    ' using a real time clock PCF8563

    ' Definitions

    DEFINE OSC 20 ' 20 MHz Oscillator frequency
    DEFINE HSER_RCSTA 90h ' Set receive register to receiver enabled
    DEFINE HSER_TXSTA 20h ' Set transmit register to transmitter enabled
    DEFINE HSER_BAUD 9600 ' Set baud rate
    Define ADC_BITS 10 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS

    'Port Definition

    Dpin var PORTB.0 ' I2C Data pin
    Cpin var PORTB.1 ' I2C Clock pin
    DA VAR PORTB.2 ' Data out
    CL VAR PORTB.3 ' Clock out
    EN VAR PORTB.4 ' Chip enable or chip select

    'Variables

    RC VAR BYTE ' Row count
    CC VAR BYTE ' Character counter
    LC VAR BYTE ' Line counter
    wData VAR WORD ' Write data
    Echo var byte ' Storage for serial character
    TAB VAR BYTE ' TAB to move across a line
    TP VAR WORD ' Temp variable holder
    T VAR BYTE ' Time variable holder
    T1 VAR BYTE ' Time variable holder
    T10 VAR BYTE ' Time variable holder
    NC VAR BYTE ' Number count
    J VAR WORD ' Table counter variable
    C VAR BYTE ' Counter variable
    Co VAR BYTE ' Counter out variable
    L VAR WORD ' Line counter
    Sz VAR BYTE ' Text size
    H VAR BYTE ' Hex number
    AS VAR BYTE ' ASCII number
    D VAR BYTE [28] ' ASCII Digits
    CS var byte [7] ' Callsgin position array
    Cx VAR BIT ' Date bit
    Tx VAR BIT ' Date bit
    SumA VAR BYTE ' Check output pins
    SumB VAR BYTE ' Check output pins
    AD0 VAR WORD ' Create ad0 to store result
    AD1 VAR WORD ' Create ad1 to store result
    X VAR BIT ' Callsign set bit

    Init:
    TRISA = %000011 ' Set as both
    ADCON1 = %00000010 ' Set PORTA analog and LEFT justify result
    TRISB = %00000011 ' Set as both
    TRISC = %11111111 ' Set as both
    H=$30 : Tx=1 : Cx=0 : X=0

    ' STV5730A initialize

    initSTV:
    High Cl :High DA :High EN ' Start up data
    Pause 250 ' 250ms wait
    wData=$3000 : GoSub Send ' Send 3000 in Hex
    wData=$3000 : GoSub Send ' Send 3000 in Hex
    wData=$00DB : GoSub Send ' Send 00DB in Hex
    wData=$1000 : GoSub Send ' Send 1000 in Hex
    wData=$00CC : GoSub Send ' Init registers (point to register 12)
    wData=$1000 : GoSub Send ' Zoom
    wData=$1000 : GoSub Send ' Colour
    wData=$1ACE : GoSub Send ' Control set to NTSC
    wData=$15A1 : GoSub Send ' Position
    wData=$183C : GoSub Send ' Mode
    wData=$00C0 : GoSub Send ' Set row attributes
    For RC=0 TO 10 ' Rows from 0 to 10
    wData=$10C4 : GoSub Send
    Next RC
    CC=0: LC=0 ' Set line and row to 0
    GOSUB CLS ' Clear video screen
    PAUSE 250
    CC=0: LC=0 ' Set line and row to 0
    GOSUB CLS ' Clear video screen
    GOTO com_set

    CLS:
    wData=lc*256+CC ' Line and row data
    GoSub Send ' Send data to STV5730A
    wData=$1F0B ' Set character to " "
    GoSub Send ' Send data to STV5730A
    CC=CC+1
    IF CC>=28 Then ' Max character count of 28
    CC=0
    lc=LC+1
    EndIF
    IF Lc=11 THEN ' Max line count of 11
    RETURN
    ELSE
    GoTo CLS
    ENDIF

    Send: ' Send data to STV5730A
    PAUSEUS 250 ' Deylay of 250 uS
    Low EN ' Set chip select low
    GoSub Serial ' Send 16 bit word
    High EN ' Set chip select pin high
    High Cl ' Set clock pin high
    High DA ' Set data pin high
    Return

    Serial: ' Serial out routine
    DA=wData.15 ' Bring Do pin high or low, depending upon bit
    PULSOUT CL,1 ' Bring Clock line high and then low
    DA=wData.14 ' Same as above
    PULSOUT CL,1 ' Same as above
    DA=wData.13
    PULSOUT CL,1
    DA=wData.12
    PULSOUT CL,1
    DA=wData.11
    PULSOUT CL,1
    DA=wData.10
    PULSOUT CL,1
    DA=wData.9
    PULSOUT CL,1
    DA=wData.8
    PULSOUT CL,1
    DA=wData.7
    PULSOUT CL,1
    DA=wData.6
    PULSOUT CL,1
    DA=wData.5
    PULSOUT CL,1
    DA=wData.4
    PULSOUT CL,1
    DA=wData.3
    PULSOUT CL,1
    DA=wData.2
    PULSOUT CL,1
    DA=wData.1
    PULSOUT CL,1
    DA=wData.0
    PULSOUT CL,1
    Return

    PC_time: ' Time comport
    T=0
    I2CREAD Dpin,Cpin,$A3,$02,[T]
    GOSUB Tcon
    CS[0]=T
    I2CREAD Dpin,Cpin,$A3,$03,[T]
    GOSUB Tcon
    CS[1]=T
    I2CREAD Dpin,Cpin,$A3,$04,[T]
    T=T&$3F
    GOSUB Tcon
    CS[2]=T
    hserout ["Time in h,m,s"]
    GOSUB linefeed ' Send text followed by carriage return and linefeed
    GOSUB linefeed ' Carriage return and linefeed
    Hserout [DEC CS[2],":",DEC CS[1],".",DEC CS[0]] ' Send text followed by carriage return and linefeed
    GOSUB linefeed
    GOSUB linefeed ' Carriage return and linefeed
    RETURN

    PC_date: ' Date comport
    I2CREAD Dpin,Cpin,$A3,$05,[T]
    T=T&$3F
    GOSUB Tcon
    CS[3]=T
    I2CREAD Dpin,Cpin,$A3,$06,[T]
    T=T&$07
    GOSUB Tcon
    CS[4]=T
    I2CREAD Dpin,Cpin,$A3,$07,[T]
    T=T&$1F
    GOSUB Tcon
    CS[5]=T
    I2CREAD Dpin,Cpin,$A3,$08,[T]
    GOSUB Tcon
    CS[6]=T
    hserout ["Date in d,m,y"] ' Send text followed by carriage return and linefeed
    GOSUB linefeed
    GOSUB linefeed ' Carriage return and linefeed
    IF CS[4]=0 THEN hserout ["Sunday",13,10]
    IF CS[4]=1 THEN hserout ["Monday",13,10]
    IF CS[4]=2 THEN hserout ["Tuesday",13,10]
    IF CS[4]=3 THEN hserout ["Wednesday",13,10]
    IF CS[4]=4 THEN hserout ["Thursday",13,10]
    IF CS[4]=5 THEN hserout ["Friday",13,10]
    IF CS[4]=6 THEN hserout ["Saturday",13,10]
    GOSUB linefeed ' Carriage return and linefeed
    Hserout [DEC CS[3],"/",DEC CS[5],"/20",DEC CS[6]] ' Send text followed by carriage return and linefeed
    GOSUB linefeed
    GOSUB linefeed ' Carriage return and linefeed
    RETURN

    Tcon:
    T=T&$7F
    T1 =($0F&T)
    T10=(T/$10)*10
    T=T10+T1
    RETURN

    Set_time:
    T10=(T10-H)*$10
    T1 =T1-H
    Co=T10+T1
    RETURN

    vcon:
    CS[1]=T DIG 0 ' Read the position of digit 2
    CS[0]=T DIG 1 ' Read the position of digit 1
    RETURN

    v_time: ' Display time via the video
    J=J+1
    I2CREAD Dpin,Cpin,$A3,$05,[T]
    T=T&$3F
    SumB=t
    IF Cx=1 AND SumA<>SumB THEN GOSUB v_date
    IF Tx=1 AND J=250 THEN GOSUB Temp
    wData=$700
    GOSUB Send
    I2CREAD Dpin,Cpin,$A3,$04,[T]
    T=T&$3F
    GOSUB Tcon
    GOSUB vcon
    for C=0 to 2 ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1],$26],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    I2CREAD Dpin,Cpin,$A3,$03,[T]
    GOSUB Tcon
    GOSUB vcon
    FOR C=0 to 2 ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1],$26],Co
    wData=$1300+Co
    GOSUB Send
    NEXT C
    I2CREAD Dpin,Cpin,$A3,$02,[T]
    GOSUB Tcon
    GOSUB vcon
    FOR C=0 to 1 ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1]],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    Hserin 40,v_time,[echo]
    IF ECHO=27 THEN
    GOSUB linefeed
    Hserout ["Exit"]
    GOSUB linefeed
    GOSUB linefeed
    GOSUB CLS
    CC=0: Lc=0 : L=0 : Cx=0 : Tx=0
    RETURN
    ENDIF
    GOTO v_time:

    v_date: ' Display date via the video
    wData=$800
    gosub Send
    I2CREAD Dpin,Cpin,$A3,$05,[T]
    T=T&$3F
    SumA=t
    GOSUB Tcon
    GOSUB vcon
    for C=0 to 2 ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1],$28],Co
    wData=$1300+Co
    GOSUB Send
    next C
    I2CREAD Dpin,Cpin,$A3,$07,[T]
    T=T&$1F
    GOSUB Tcon
    GOSUB vcon
    for C=0 to 2 ' Read data out to STV5730A
    LOOKUP2 C,[CS[0],CS[1],$28],Co
    wData=$1300+Co
    GOSUB Send
    next C
    I2CREAD Dpin,Cpin,$A3,$08,[T]
    GOSUB Tcon
    GOSUB vcon
    FOR C=0 to 3 ' Read data out to STV5730A
    LOOKUP2 C,[2,0,CS[0],CS[1]],Co
    wData=$1300+Co
    GOSUB Send
    NEXT C
    RETURN

    Tempcom: ' Read temperture
    GOSUB Tmp1
    IF D[3]=$0B THEN
    D[3]=32
    ELSE
    D[3]=D[3]+H
    ENDIF
    IF D[2]<$0A THEN D[2]=D[2]+H
    IF D[2]=$0B THEN D[2]=32
    IF D[2]=$0A THEN D[2]=45
    Hserout ["temp 1 ",D[2],D[3],D[4]+H,"C"]
    GOSUB linefeed
    GOSUB Tmp2
    IF D[3]=$0B THEN
    D[3]=32
    ELSE
    D[3]=D[3]+H
    ENDIF
    IF D[2]<$0A THEN D[2]=D[2]+H
    IF D[2]=$0B THEN D[2]=32
    IF D[2]=$0A THEN D[2]=45
    Hserout ["temp 2 ",D[2],D[3],D[4]+H,"C"]
    GOSUB linefeed
    GOSUB linefeed
    RETURN

    Temp: ' Display Temperture via the video
    wData=$70C
    gosub Send
    for C=0 to 10 ' Read data out to STV5730A
    LOOKUP2 C,[$1F,$2E,$36,$39,$2E,$3B,$2A,$3D,$3E,$3B,$2E],Co
    wData=$1300+Co
    gosub Send
    next C
    GOSUB Tmp1
    wData=$80C
    gosub Send
    for C=0 to 5 ' Read data out to STV5730A
    LOOKUP2 C,[$1,$0B,D[2],D[3],D[4],$0E],Co
    wData=$1300+Co
    gosub Send
    next C
    GOSUB Tmp2
    wData=$814
    gosub Send
    for C=0 to 5 ' Read data out to STV5730A
    LOOKUP2 C,[$2,$0B,D[2],D[3],D[4],$0E],Co
    wData=$1300+Co
    gosub Send
    next C
    Tx=1
    J=0
    RETURN

    Tmp1:
    ADCIN 0,AD0 ' Read ADC one
    Tp=AD0/64
    GOSUB Temp_C
    RETURN

    Tmp2:
    ADCIN 1,AD1 ' Read ADC two
    Tp=AD1/64
    GOSUB Temp_C
    RETURN

    Temp_C:
    IF Tp>=559 THEN
    J=(Tp-559)*100 ' Calulate out temperture in +
    C=J/205
    ELSE
    J=(Tp-354)*100 ' Calulate out temperture in -
    C=100-(J/205)
    ENDIF
    GOSUB AtoDcaL
    RETURN

    AtoDcaL:
    D[4]=C DIG 0 ' Read the position of digit 5
    D[3]=C DIG 1 ' Read the position of digit 4
    D[2]=C DIG 2 ' Read the position of digit 3
    D[1]=C DIG 3 ' Read the position of digit 2
    D[0]=C DIG 4 ' Read the position of digit 1
    IF D[0]+D[1]+D[2]+D[3]=0 THEN D[3]=$0B ' Add space in (Hex B)
    IF D[0]+D[1]+D[2]=0 THEN D[2]=$0B
    IF D[0]+D[1]=0 THEN D[1]=$0B
    IF D[0]=0 THEN D[0]=$0B
    RETURN

    ' Comport setup

    com_set:
    wData=0 : Sz=0
    L=0 : TAB=0 : J=0
    CC=0: Lc=0 : Cx=0 : Tx=0
    hserout ["Video overlay"] ' Send text followed by carriage return and linefeed
    GOSUB linefeed
    Hserout ["by Grant VE3XTV"] ' Send text followed by carriage return and linefeed
    GOSUB linefeed ' Carriage return and linefeed

    com_start: ' Comport start up
    IF Sz=0 THEN
    wData=$00CC
    GoSub Send
    wData=$1000
    GoSub Send
    ENDIF
    IF Sz=1 THEN
    wData=$00CC
    GoSub Send
    wData=$1555
    GoSub Send
    ENDIF
    IF Sz=2 THEN
    wData=$00CC
    GoSub Send
    wData=$1AAA
    GoSub Send
    ENDIF
    IF Sz=3 THEN
    wData=$00CC
    GoSub Send
    wData=$1FFF
    GoSub Send
    ENDIF

    com:
    FOR NC=1 TO 10
    Hserin 4000,com_start,[echo] ' Get a echo from serial port
    IF ECHO=13 THEN
    GOTO getinfo
    GOTO com
    ENDIF
    IF NC=1 THEN D[0]=ECHO ' Store last 10 ASCII digits
    IF NC=2 THEN D[1]=ECHO
    IF NC=3 THEN D[2]=ECHO
    IF NC=4 THEN D[3]=ECHO
    IF NC=5 THEN D[4]=ECHO
    IF NC=6 THEN D[5]=ECHO
    IF NC=7 THEN D[6]=ECHO
    IF NC=8 THEN D[7]=ECHO
    IF NC=9 THEN D[8]=ECHO
    IF NC=10 THEN D[9]=ECHO
    Hserout [echo] ' Send echo out serial port
    NEXT NC
    Goto com

    getinfo:
    GOSUB linefeed
    IF D[0]=67 AND D[1]=76 AND D[2]=83 THEN ' CLS Clear screen
    GOSUB CLS
    GOSUB linefeed
    Hserout ["Clear screen"]
    GOSUB linefeed
    GOSUB linefeed
    CC=0: Lc=0 : L=0 : Cx=0 : Tx=0
    GOTO com
    ENDIF
    IF D[0]=67 THEN ' C?????? set callsgin
    CS[0]=D[1] : CS[1]=D[2] : CS[2]=D[3] : CS[3]=D[4] : CS[4]=D[5] : CS[5]=D[6]
    GOSUB linefeed
    Hserout ["Set to ",CS[0],CS[1],CS[2],CS[3],CS[4],CS[5]]
    GOSUB linefeed
    GOSUB linefeed
    GOTO com
    ENDIF
    IF D[0]=68 AND D[1]=67 THEN ' DC display callsgin
    GOSUB DC
    GOSUB linefeed
    Hserout ["Display callsgin"]
    GOSUB linefeed
    GOSUB linefeed
    GOTO com
    ENDIF
    IF D[0]=84 AND D[1]=89 AND D[2]=80 AND D[3]=69 THEN ' TYPE keyboard mode
    GOSUB linefeed
    Hserout ["Keyboard mode"]
    GOSUB linefeed
    GOSUB linefeed
    GOTO TYPE
    ENDIF ' Font size=1
    IF D[0]=72 AND D[1]=49 THEN
    Sz=0
    GOSUB linefeed
    Hserout ["Font size=1"]
    GOSUB linefeed
    GOSUB linefeed
    ENDIF
    IF D[0]=72 AND D[1]=50 THEN
    Sz=1
    GOSUB linefeed
    Hserout ["Font size=2"] ' Font size=2
    GOSUB linefeed
    GOSUB linefeed
    ENDIF
    IF D[0]=72 AND D[1]=51 THEN
    Sz=2
    GOSUB linefeed
    Hserout ["Font size=3"] ' Font size=3
    GOSUB linefeed
    GOSUB linefeed
    ENDIF
    IF D[0]=72 AND D[1]=52 THEN
    Sz=3
    GOSUB linefeed
    Hserout ["Font size=4"] ' Font size=4
    GOSUB linefeed
    GOSUB linefeed
    ENDIF
    IF D[0]=82 AND D[1]=68 THEN ' 82 and 68 is RD to read callsgin
    GOSUB linefeed
    GOSUB Rdata
    ENDIF
    IF D[0]=87 AND D[1]=68 THEN ' 82 and 68 WD write data
    GOSUB linefeed
    GOSUB Memstore
    Hserout ["Writing data"]
    GOSUB linefeed
    GOSUB linefeed
    GOTO com
    ENDIF
    IF D[0]=84 AND D[1]=73 AND D[2]=77 AND D[3]=69 THEN ' TIME display time on PC
    GOSUB linefeed
    Hserout ["Time is"]
    GOSUB linefeed
    GOSUB linefeed
    GOSUB PC_time
    GOTO com
    ENDIF
    IF D[0]=68 AND D[1]=65 AND D[2]=84 AND D[3]=69 THEN ' DATE display time on PC
    GOSUB linefeed
    Hserout ["Date is"]
    GOSUB linefeed
    GOSUB linefeed
    GOSUB PC_date
    GOTO com
    ENDIF
    IF D[0]=83 AND D[1]=84 THEN ' ST Set time format "hh:mm" enter to set
    T10=D[2] : T1=D[3]
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$04,[Co]
    T10=D[5] : T1=D[6]
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$03,[Co]
    GOSUB linefeed
    Hserout [D[2],D[3],":",D[5],D[6]]
    GOSUB linefeed
    GOSUB linefeed
    GOTO com
    ENDIF
    IF D[0]=83 AND D[1]=83 THEN ' SS Set seconds format "ss" enter to set
    GOSUB linefeed
    Hserout [D[2],D[3]," seconds"]
    GOSUB linefeed
    GOSUB linefeed
    T10=D[2] : T1=D[3]
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$02,[Co]
    GOTO com
    ENDIF
    IF D[0]=83 AND D[1]=68 THEN ' SD Set date format "dd/MM/YY" enter to set
    T10=D[2] : T1=D[3]
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$05,[Co]
    T10=D[5] : T1=D[6]
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$07,[Co]
    T10=D[8] : T1=D[9]
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$08,[Co]
    GOSUB linefeed
    Hserout [D[2],D[3],"/",D[5],D[6],"/",D[8],D[9]]
    GOSUB linefeed
    GOSUB linefeed
    GOTO com
    ENDIF
    IF D[0]=83 AND D[1]=87 THEN ' SW Set week day format "w" enter to set
    GOSUB linefeed
    Hserout [D[2]," day of the week"]
    GOSUB linefeed
    GOSUB linefeed
    T10=0 : T1=D[2]
    GOSUB Set_time
    I2CWRITE Dpin,Cpin,$A2,$06,[Co]
    GOTO com
    ENDIF
    IF D[0]=68 AND D[1]=84 AND D[2]<>77 AND D[3]<>80 THEN ' DT Display time via video
    J=0
    GOSUB linefeed
    Hserout ["Display time"]
    GOSUB linefeed
    GOSUB linefeed
    GOSUB v_time
    ENDIF
    IF D[0]=68 AND D[1]=68 THEN ' DD Display date via video
    Cx=1
    GOSUB linefeed
    Hserout ["Display date"]
    GOSUB linefeed
    GOSUB linefeed
    GOSUB v_date
    ENDIF
    IF D[0]=68 AND D[1]=84 AND D[2]=77 AND D[3]=80 THEN ' DTMP display temperature via video
    Tx=1
    GOSUB linefeed
    Hserout ["Display temperature"]
    GOSUB linefeed
    GOSUB linefeed
    GOSUB temp
    ENDIF
    IF D[0]=84 AND D[1]=69 AND D[2]=77 AND D[3]=80 THEN ' TEMP display temperature
    GOSUB linefeed
    Hserout ["Temperature is"]
    GOSUB linefeed
    GOSUB linefeed
    GOSUB Tempcom
    GOTO com
    ENDIF
    IF D[0]=72 AND D[1]=69 AND D[2]=76 AND D[3]=80 THEN ' HELP infomation
    GOSUB linefeed
    Hserout ["CLS clear display"]
    GOSUB linefeed
    Hserout ["DC display callsgin"]
    GOSUB linefeed
    Hserout ["DTMP display temperature"]
    GOSUB linefeed
    Hserout ["DT display time"]
    GOSUB linefeed
    Hserout ["DD display date"]
    GOSUB linefeed
    Hserout ["H1,H2,H3,H4 font sizes 1x up to 4x"]
    GOSUB linefeed
    Hserout ["TYPE keyboard text mode, video overlay"]
    GOSUB linefeed
    Hserout ["TIME display time on PC"]
    GOSUB linefeed
    Hserout ["DATE display date on PC"]
    GOSUB linefeed
    Hserout ["TEMP display temperature on PC"]
    GOSUB linefeed
    GOSUB linefeed
    Hserout ["****** Setup information ******"]
    GOSUB linefeed
    Hserout ["RD read data"]
    GOSUB linefeed
    Hserout ["WD write data"]
    GOSUB linefeed
    Hserout ["C?????? set callsgin"]
    GOSUB linefeed
    Hserout ["SS set seconds format 'ss'"]
    GOSUB linefeed
    Hserout ["ST set time format 'hh:mm'"]
    GOSUB linefeed
    Hserout ["SD set date format 'dd/MM/YY'"]
    GOSUB linefeed
    Hserout ["SW set week day format 'w'"]
    GOSUB linefeed
    GOSUB linefeed
    GOTO com
    ENDIF
    GOTO com_start

    Rdata:
    GOSUB linefeed
    Hserout ["Font size=",DEC Sz+1]
    GOSUB linefeed
    GOSUB Memread
    GOSUB linefeed
    Hserout ["Callsgin=",CS[0],CS[1],CS[2],CS[3],CS[4],CS[5]] ' Send message
    GOSUB linefeed
    GOSUB linefeed
    GOSUB linefeed
    rETURN

    Memstore: ' Store Callsign
    FOR C=0 TO 5
    WRITE C,CS[C]
    NEXT C
    RETURN

    Memread: ' Read Callsign
    FOR C=0 TO 5
    READ C,CS[C]
    NEXT C
    RETURN

    DCLS: ' Clear the screen set to ' '
    FOR C=0 TO 27
    D[C]=32
    NEXT C
    RETURN

    com1:
    GOSUB DCLS
    FOR NC=1 TO 28
    Hserin 4000,com1,[echo] ' Get a echo from serial port
    IF ECHO=13 THEN GOTO TYPE1
    IF ECHO=9 THEN GOSUB Tabspace
    IF ECHO=92 THEN
    GOSUB CLS : CC=0: Lc=0 : L=0
    GOTO com1 : ENDIF
    IF ECHO=8 THEN
    GOSUB Backspace : ENDIF
    IF ECHO=27 THEN
    GOSUB linefeed
    Hserout ["Exit"]
    GOSUB linefeed
    GOSUB linefeed
    GOTO com : ENDIF
    IF NC=1 THEN D[0]=ECHO ' Store last 28 ASCII digits
    IF NC=2 THEN D[1]=ECHO
    IF NC=3 THEN D[2]=ECHO
    IF NC=4 THEN D[3]=ECHO
    IF NC=5 THEN D[4]=ECHO
    IF NC=6 THEN D[5]=ECHO
    IF NC=7 THEN D[6]=ECHO
    IF NC=8 THEN D[7]=ECHO
    IF NC=9 THEN D[8]=ECHO
    IF NC=10 THEN D[9]=ECHO
    IF NC=11 THEN D[10]=ECHO
    IF NC=12 THEN D[11]=ECHO
    IF NC=13 THEN D[12]=ECHO
    IF NC=14 THEN D[13]=ECHO
    IF NC=15 THEN D[14]=ECHO
    IF NC=16 THEN D[15]=ECHO
    IF NC=17 THEN D[16]=ECHO
    IF NC=18 THEN D[17]=ECHO
    IF NC=19 THEN D[18]=ECHO
    IF NC=20 THEN D[19]=ECHO
    IF NC=21 THEN D[20]=ECHO
    IF NC=22 THEN D[21]=ECHO
    IF NC=23 THEN D[22]=ECHO
    IF NC=24 THEN D[23]=ECHO
    IF NC=25 THEN D[24]=ECHO
    IF NC=26 THEN D[25]=ECHO
    IF NC=27 THEN D[26]=ECHO
    IF NC=28 THEN D[27]=ECHO
    Hserout [echo] ' Send echo out serial port
    NEXT NC
    Goto com1

    Tabspace:
    TAB=TAB+7
    FOR C=1 TO 7
    Echo=32
    Hserout [echo]
    NEXT C
    RETURN

    Backspace:
    NC=NC-1
    IF NC<=1 THEN NC=1
    LOOKUP2 Nc,[0,D[0],D[1],D[2],D[3],D[4],D[5],D[6],D[7],D[8],D[9],D[10],D[11],D[12],D[13],D[14],D[15],D[16],D[17],D[18],D[19],D[20],D[21],D[22],D[23],D[24],D[25],D[26],D[27]],Co
    Co=Echo
    Hserout [echo]
    Hserin 2000,com_start,[echo] ' Get a echo from serial port
    IF ECHO=8 THEN GOTO Backspace
    RETURN

    DC: ' Display Callsgin
    GOSUB DCLS
    GOSUB Memread
    FOR C=0 TO 5
    AS=CS[C]
    GOSUB Convert
    D[C]=AS
    NEXT C
    X=1
    GOSUB Display
    X=0
    RETURN

    TYPE: ' Conversion for the video overlay
    GOSUB linefeed
    GOTO com1
    TYPE1:
    GOSUB linefeed
    AS=D[0]
    GOSUB Convert
    D[0]=AS
    AS=D[1]
    GOSUB Convert
    D[1]=AS
    AS=D[2]
    GOSUB Convert
    D[2]=AS
    AS=D[3]
    GOSUB Convert
    D[3]=AS
    AS=D[4]
    GOSUB Convert
    D[4]=AS
    AS=D[5]
    GOSUB Convert
    D[5]=AS
    AS=D[6]
    GOSUB Convert
    D[6]=AS
    AS=D[7]
    GOSUB Convert
    D[7]=AS
    AS=D[8]
    GOSUB Convert
    D[8]=AS
    AS=D[9]
    GOSUB Convert
    D[9]=AS
    AS=D[10]
    GOSUB Convert
    D[10]=AS
    AS=D[11]
    GOSUB Convert
    D[11]=AS
    AS=D[12]
    GOSUB Convert
    D[12]=AS
    AS=D[13]
    GOSUB Convert
    D[13]=AS
    AS=D[14]
    GOSUB Convert
    D[14]=AS
    AS=D[15]
    GOSUB Convert
    D[15]=AS
    AS=D[16]
    GOSUB Convert
    D[16]=AS
    AS=D[17]
    GOSUB Convert
    D[17]=AS
    AS=D[18]
    GOSUB Convert
    D[18]=AS
    AS=D[19]
    GOSUB Convert
    D[19]=AS
    AS=D[20]
    GOSUB Convert
    D[20]=AS
    AS=D[21]
    GOSUB Convert
    D[21]=AS
    AS=D[22]
    GOSUB Convert
    D[22]=AS
    AS=D[23]
    GOSUB Convert
    D[23]=AS
    AS=D[24]
    GOSUB Convert
    D[24]=AS
    AS=D[25]
    GOSUB Convert
    D[25]=AS
    AS=D[26]
    GOSUB Convert
    D[26]=AS
    AS=D[27]
    GOSUB Convert
    D[27]=AS
    GOSUB Display
    GOTO com1

    Convert: ' Convert from ACSII to TROM data of the STV5730A
    IF AS>=48 AND AS<=57 THEN
    AS=AS-48
    RETURN
    ENDIF
    IF AS>=65 AND AS<=90 THEN
    AS=AS-53
    RETURN
    ENDIF
    IF AS>=97 AND AS<=122 THEN
    AS=AS-55
    RETURN
    ENDIF
    IF AS>=46 AND AS<=47 THEN
    AS=AS-7
    RETURN
    ENDIF
    IF AS=45 THEN
    AS=$A
    RETURN
    ENDIF
    IF AS=32 THEN
    AS=$B
    RETURN
    ENDIF
    IF AS=34 THEN
    AS=$6F
    RETURN
    ENDIF
    IF AS=58 THEN
    AS=$26
    RETURN
    ENDIF
    IF AS=39 THEN
    AS=$29
    RETURN
    ENDIF
    IF AS=42 THEN
    AS=$5F
    RETURN
    ENDIF
    IF AS=43 THEN
    AS=$5E
    RETURN
    ENDIF
    IF AS=63 THEN
    AS=$70
    RETURN
    ENDIF
    IF AS=60 THEN
    AS=$7B
    RETURN
    ENDIF
    IF AS=62 THEN
    AS=$7A
    RETURN
    ENDIF
    IF AS=94 THEN
    AS=$7C
    RETURN
    ENDIF
    IF AS=124 THEN
    AS=$7D
    RETURN
    ENDIF
    IF AS=35 THEN
    AS=$6E
    RETURN
    ENDIF
    IF AS=36 THEN
    AS=$71
    RETURN
    ENDIF
    IF AS=37 THEN
    AS=$79
    RETURN
    ENDIF
    IF AS=64 THEN
    AS=$45
    RETURN
    ENDIF
    IF AS=61 THEN
    AS=$78
    ELSE
    AS=$B
    ENDIF
    RETURN

    Display: ' Font size 1 to 4
    IF Sz=0 THEN GOSUB Size_1
    IF Sz=1 THEN GOSUB Size_2
    IF Sz=2 THEN GOSUB Size_3
    IF Sz=3 THEN GOSUB Size_4
    RETURN

    Size_1:
    wData=L+tab
    gosub Send
    IF X=0 THEN
    J=27
    ELSE
    J=5
    ENDIF
    FOR C=0 TO J
    LOOKUP2 c,[D[0],D[1],D[2],D[3],D[4],D[5],D[6],D[7],D[8],D[9],D[10],D[11],D[12],D[13],D[14],D[15],D[16],D[17],D[18],D[19],D[20],D[21],D[22],D[23],D[24],D[25],D[26],D[27]],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    L=L+$100
    IF L=$B00 THEN L=0
    TAB=0
    RETURN

    Size_2:
    wData=L+tab
    gosub Send
    FOR C=0 TO 13
    LOOKUP2 c,[D[0],D[1],D[2],D[3],D[4],D[5],D[6],D[7],D[8],D[9],D[10],D[11],D[12],D[13]],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    L=L+$100
    IF L=$600 THEN L=0
    TAB=0
    RETURN

    Size_3:
    wData=L+tab
    gosub Send
    FOR C=0 TO 9
    LOOKUP2 c,[D[0],D[1],D[2],D[3],D[4],D[5],D[6],D[7],D[8],D[9]],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    L=L+$100
    IF L=$400 THEN L=0
    TAB=0
    RETURN

    Size_4:
    wData=L+tab
    gosub Send
    FOR C=0 TO 6
    LOOKUP2 c,[D[0],D[1],D[2],D[3],D[4],D[5],D[6]],Co
    wData=$1300+Co
    gosub Send
    NEXT C
    L=L+$100
    IF L=$300 THEN L=0
    TAB=0
    RETURN

    linefeed:
    Hserout [13,10]
    return

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    sorry, thought it was too much to put in a message
    that's why code tags help and are reccomended .
    if its not too late maybe you can edit it and put them in

    ps it won't compile because its too big to fit in your chip.
    Last edited by richard; - 14th May 2017 at 13:42.
    Warning I'm not a teacher

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,519


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    Hi Ed,
    Of course you're not sending an infected file - intentionally - but people are being careful, just like you and that's a good thing. It's not to much code to post but you really should use the proper code tags so it ends up in a scrollable window and doesn't loose indentation etc. See here: https://www.bbcode.org/examples/?id=15 for instructions on how to use it.

    Back to your problem then....
    I tried compiling your code for the 18F452 and it compiled without any errors. I also tried the mentioned 16F876A but then I get a couple of error from the assembler (Argument out of range 8207 not between 0 and 8191) however selecting another random 16F series device (like the 16F1829) makes it compile without any errors.

    For which device are you trying to compile?
    What version of PBP are using?
    What version of MPASM are you using?

    /Henrik.

  9. #9
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    Hi Henrik!
    Thank you! Ultimately I would like to use the 18F1320. I just tried to compile with the 16F876A as that was what Grant said was the PIC the code was written for. I am using the latest PBP 3.1 and MPASM 8.92, Windows 7 64 bit.

    Thanks, Ed

  10. #10
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,519


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    But when I compile for the 16F876A I don't get the same errors you're reporting.

    I just tried again, on a machine with PBP 3.0.8.4 and MPASM 5.61 (from MPLABX 2.35) and for the 16F876A I get the same errors I reported earlier - I do not get any of the errors you report. The errors I *do* get is most likely because the code is too big to fit in the 876A - as Richard points out. Where your Syntax Errors is coming from I have no idea.

    The compiled code size for an 18F series device is 15242 bytes and the 18F1320 is an 8k device so it won't fit as is.

    I'd probably update MPLAB to a newer version, you'll need it to use the new devices added in PBP3.1

    /Henrik.

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: HELP!!! OSD Hserout problem??

    Where your Syntax Errors is coming from I have no idea
    .

    most likely code ed is compiling != code posted.



    LOOKUP2 c,[D[0],D[1],D[2],D[3],D[4],D[5],D[6]],Co
    is this a deliberate ploy to fill unused code space ?
    Warning I'm not a teacher

Similar Threads

  1. Problem with HSEROUT/HSERIN
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2013, 09:43
  2. HSEROUT problem
    By karlosguay in forum Serial
    Replies: 3
    Last Post: - 11th January 2012, 19:44
  3. HSEROUT problem
    By Williamaybe in forum Serial
    Replies: 15
    Last Post: - 18th July 2008, 05:17
  4. HSEROUT problem at 20MHz
    By manxman in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 27th May 2006, 22:55
  5. HSEROUT Problem
    By Keith in forum General
    Replies: 2
    Last Post: - 25th June 2005, 15:09

Members who have read this thread : 1

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