Announcement

Collapse
No announcement yet.

ulcd70dt and uart

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ulcd70dt and uart

    Hi friends here the Alain from belgium years ago i was program with the 16f 18f in picbasic so is there here on the web a code or demo that runs pic 16f or other to make tx rx to my ulcd70dt i will if a run my pll from amateur tv 2300 2400 mhz (now working verry fine on my 2 * 20 lcd the variable dat to send on mij new 4d systems my queastion what must i do to link perfect the 4dsystems to my pic now its al in a 16f628a i will rset the displ write the freq to a leddigit buth after try a week nopes here ok good weekend friends sqee you all from the belgium coast ON7ATV or alain

  • #2
    What platform are you using?

    Can you show us your code, maybe someone can spot an error?
    Mark

    Comment


    • #3
      hello marc i'm use the old picbasic i'm write it years ago so the problem is if the frequebtie is runs on my lcd i will the freq also on my 4d system hre is the picbasic code


      ' ** DÉCLARATION DE LA CONFIGURATION HARD
      DEFINE LCD_DREG PORTB 'LCD data port
      DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
      DEFINE LCD_RSREG PORTB 'LCD register select port
      DEFINE LCD_RSBIT 4 'LCD register select bit
      DEFINE LCD_EREG PORTB 'LCD enable port
      DEFINE LCD_EBIT 5 'LCD enable bit
      'DEFINE LCD_RWREG PORTB 'LCD read/write port
      'DEFINE LCD_RWBIT 4 'LCD read/write bit
      DEFINE LCD_BITS 4 'LCD bus size 4 or 8
      DEFINE LCD_LINES 4 'Number lines on LCD
      DEFINE LCD_DATAUS 50
      'DEFINE LCD_COMMANDUS 2000 'Command delay time in us

      'DEFINE LCD_DREG PORTB 'Selection du port B
      'DEFINE LCD_DBIT 4 'Selection de RB4 à RB7
      'DEFINE LCD_RSREG PORTB 'RS sur port B
      'DEFINE LCD_RSBIT 1 'RS sur RB1
      'DEFINE LCD_EREG PORTB
      'DEFINE LCD_EBIT 3 'E sur RB3
      'DEFINE LCD_BITS 4 'Mode 4 bits
      'DEFINE LCD_LINES 2 '1 ligne

      DEFINE I2C_SCLOUT 1

      ' ** DÉFINITION DES ENTREES - SORTIES

      ' Sorties I2C
      SCL var PORTB.1 ' SCL sur RB1 (pin 7)
      SDA var PORTB.0 ' SDA sur RB0 (pin 6)

      'Boutons
      MEMO var PORTA.2 ' Bouton de mémorisation sur RA2 (pin 1)
      UP var PORTA.0 'augmente la fréquence (sur RA0)
      DOWN var PORTA.1 'diminue la fréquence (sur RA1)
      CH_PAS var PORTA.4 'Change le pas du synthé (sur RA4)
      SEL var PORTA.3 'Choix VFO A ou B (sur RA3)

      INPUT UP 'Up et Down sont des entrées
      INPUT DOWN
      INPUT MEMO
      INPUT CH_PAS
      INPUT SEL

      ' ** DÉCLARATION DES VARIABLES

      b1 var BYTE
      b2 var BYTE
      b3 var BYTE
      b5 var BYTE
      b6 var BYTE
      b7 var BYTE

      F1 var WORD
      F2 var WORD
      F3 var WORD

      W1 var BYTE
      W2 var WORD


      ADDR1 VAR BYTE
      TMP VAR WORD
      TMP_LO VAR TMP.LOWBYTE
      TMP_HI VAR TMP.HIGHBYTE
      PLLBASE VAR WORD
      PLL VAR WORD
      LO VAR PLL.LOWBYTE
      HI VAR PLL.HIGHBYTE
      PAS VAR BYTE '1=125kHz, 2=250kHz, 4=500kHz, 8=1MHz

      '*** DONNEES INITIALES ***

      ADDR1=$C2 'adresse I2C du SDA5055
      PLLBASE=16000 'début à 2000 MHz : 2200 / 0,125 = 17600
      PAS = 1 ' pas de 125 kHz par défaut
      PAUSE 100
      LOW PORTB.2 'Met RB2 = R/W à 0
      LCDOUT $FE, 1 ' Clear LCD screen
      LCDOUT "ATV TX 13 cm LCD" ' affiche numéro de version pendant 1 seconde
      LCDOUT $FE,$C0
      LCDOUT " ON5VW ZOTTEGEM"
      W1=0
      W2="A"
      PAUSE 3000

      EEPROM 0,[$A0,$09,$00,$0A] 'données initiales TMP =2464 ($9A0) correspond à F = 2308 MHz
      ' TMP = 2560 ($A00) correspond à 2320 MHz
      ' Le point de départ est 2000 MHz donné par PLLBASE. On rajoute un décalage de 125kHz * TMP
      'TMP est sur 16 bits, donc 65535 fréquences possibles.
      '
      '*** LECTURE DU DECALAGE TMP ***

      LECTURE:

      READ W1,TMP_LO 'lit les 8 bits de poids faible
      READ W1+1,TMP_HI 'lit les 8 bits de poids fort


      ' *** DÉBUT DU PROGRAMME ***

      MAIN:
      PLL = PLLBASE + TMP
      I2CWRITE SDA,SCL,ADDR1,[HI,LO,$8E] 'Envoi des données au module

      GOSUB CALCUL 'calcule la fréquence pour l'affichage
      GOSUB AFFICHAGE 'affiche la fréquence
      PAUSE 500


      '*** BOUCLE PRINCIPALE ***

      BOUCLE:
      BUTTON SEL,0,255,0,b6,1,VFO_A 'surveille le bouton SEL: 0=VFO A
      BUTTON SEL,1,255,0,b7,1,VFO_B ' 1= VFO B

      BUTTON UP,0,10,2,b1,1,MONTE 'surveille le bouton UP
      BUTTON DOWN,0,10,2,b2,1,DESCEND 'surveille le bouton DOWN
      BUTTON MEMO,0,255,0,b5,1,STORE 'surveille le bouton MEMO
      BUTTON CH_PAS,0,255,0,b3,1, CHOIX 'surveille le bouton PAS
      PAUSE 100 'pause de 0.1s
      GOTO BOUCLE

      VFO_A: 'Change de VFO
      W1=0
      W2="A"
      GOTO LECTURE

      VFO_B:
      W1=2
      W2="B"
      GOTO LECTURE


      MONTE: '** AUGMENTE LA FRÉQUENCE DE 1 PAS

      TMP = TMP + PAS
      IF TMP > 5200 THEN TMP = 0 'Fmax = 2650 MHz
      GOTO MAIN

      DESCEND: '** DIMINUE LA FREQUENCE DE 1 PAS

      IF TMP<PAS THEN RAZ_TMP
      IF TMP = 0 THEN TOP
      TMP = TMP - PAS
      GOTO MAIN

      TOP: TMP=5200
      GOTO MAIN

      RAZ_TMP: TMP = 0
      GOTO MAIN

      CHOIX: '** CHOIX DU PAS

      IF PAS = 80 THEN SAUTE
      IF PAS = 8 THEN DIX_MEGA
      PAS = PAS*2
      GOSUB AFFICHE_PAS
      GOSUB CALCUL
      GOSUB AFFICHAGE 'affiche la fréquence
      GOTO BOUCLE

      SAUTE: PAS = 1
      GOSUB AFFICHE_PAS
      GOSUB CALCUL
      GOSUB AFFICHAGE 'affiche la fréquence
      GOTO BOUCLE

      DIX_MEGA: 'Pas de 10 MHz
      PAS = 80
      GOSUB AFFICHE_PAS
      GOSUB CALCUL
      GOSUB AFFICHAGE 'affiche la fréquence
      GOTO BOUCLE

      CALCUL: ' ** CALCUL DE LA FREQUENCE

      F1= PLL-16000 'retranche 2GHz
      F2=F1/8 'donne les MHz
      F3=125*(F1//8) 'donne les kHz
      RETURN

      AFFICHAGE:
      LCDOUT $FE, 1 ' Clear LCD screen
      LCDOUT #2 'affiche le 2 des Giga
      LCDOUT DEC3 F2 'affiche les autres digits
      LCDOUT "." 'affiche la virgule
      LCDOUT DEC3 F3 'affiche les kHz
      LCDOUT " MHz "
      LCDOUT W2 'affiche A ou B selon le VFO utilisé
      LCDOUT $FE,$C0
      LCDOUT " ON5VW -- ATV"
      RETURN

      AFFICHE_PAS: 'Affichage du pas

      LCDOUT $FE, 1 ' Clear LCD screen
      LCDOUT "STAP "
      LCDOUT # 125*PAS
      LCDOUT " kHz"
      PAUSE 1000
      RETURN

      '*** MEMORISATION DE LA FRÉQUENCE

      STORE:
      WRITE W1, TMP_LO 'Stocke les 8 bits de poids faible de TMP dans l'EEPROM à l'adresse 0
      WRITE W1+1, TMP_HI 'Stocke les 8 bits de poids fort de TMP dans l'EEPROM à l'adresse 1
      LCDOUT $FE, 1
      LCDOUT "SAVED OP VFO "
      LCDOUT W2
      PAUSE 1000
      GOSUB CALCUL 'recalcule la fréquence
      GOSUB AFFICHAGE
      GOTO BOUCLE

      Comment


      • #4
        this part of my program i will displayed on my ulcd70dt what are the settings for display the read out to the 70dt ????? i'm new sorry for that


        AFFICHAGE:
        LCDOUT $FE, 1 ' Clear LCD screen
        LCDOUT #2 'affiche le 2 des Giga
        LCDOUT DEC3 F2 'affiche les autres digits
        LCDOUT "." 'affiche la virgule
        LCDOUT DEC3 F3 'affiche les kHz
        LCDOUT " MHz "
        LCDOUT W2 'affiche A ou B selon le VFO utilisé

        RETURN

        Comment


        • #5
          Cardan: You want to use Serial communications from your PIC device to the 4D display,it appears you are trying to use picbasic LCDOUT commands.You should be using the HSEROUT commands.You will use the hardware Tx/Rx pins on your pic device.
          I would suggest you get started by hooking up your display to your computer with the programming cable and try the Serial Communicator program to try out the commands.This is part of the Workshop environment. There is also a separate PDF with the Diablo serial commands listed....

          Link to Getting started PDF:http://www.4dsystems.com.au/appnote/4D-AN-00110/

          EDIT: here is a link to some code using the Serout commands,this might be more helpful.
          http://www.picbasic.co.uk/forum/showthread.php?t=14113

          Regards
          Bob
          Last edited by rcbandwidth; 22nd December 2014, 01:56 AM.

          Comment


          • #6
            i will try buth i'm looking in the code grtz alain

            Comment


            • #7
              hmmmmmmmmmm will not work i think i must define some parameters for the lcd70dt buth how in the terminal if a write a parameter its works nothing in my pic hi

              Comment


              • #8
                Cardan: Can you show a sketch of how you have your PIC wired to the lcd70dt,Are you aware that your PIC device will also need to control the RESET line on the lcd.

                Did you get the display to work when you had it hooked up to your computer using the 4D programming cable?,this should be your first step as it verifies you have a working display.

                Regards
                Bob

                Comment


                • #9
                  Hallo RCBANDWITDH yes i try with the usb to 5 pins connector on the lcd and via the terminal or gfx in the tools its works fine large letters other color a reset thats not problem now i connect my pic to the lcd via rx tx and reset via the program header thats will use on the usb prog cable greetings alain

                  Comment


                  • #10
                    pic tx is lcd rx pic rx is lcd tx reset is a litlle time that i have in the begin of the prog with my pic thats alll greetings alain belgium

                    Comment


                    • #11
                      Hello alain: Are you still having a problem or have you made some progress?...If it still is not working post the code you are currently using,this will help a lot.
                      Which PIC device are you using?.....

                      Comment


                      • #12
                        wrong code here set tommorow my new test settings
                        Last edited by cardan; 26th December 2014, 10:04 AM.

                        Comment


                        • #13
                          hmmmmmmmmm straings i can not define my serial setting in the genie only in out pins ???

                          Comment


                          • #14
                            Hmm, I can't quite understand that. Are you perhaps looking for the options on the File, Options, Genie screen?
                            Mark

                            Comment


                            • cardan
                              cardan commented
                              Editing a comment
                              hey marc yes in the part options i set my rx tx pins thanks for that

                          • #15
                            here is a test with slider and leddigit its runs and have look to de rx tx pins now p4 and p5 for comm 0

                            #platform "uLCD-70DT"

                            // generated 26/12/2014 1:48:00

                            #MODE RUNFLASH

                            #inherit "4DGL_16bitColours.fnc"

                            #inherit "VisualConst.inc"


                            #inherit "testpa41GenieConst.inc"


                            #constant IPDatasize 22

                            #CONST
                            CMDLenMAX 80
                            #END

                            #CONST
                            BGIMAGE 0x0020
                            ACK 0x06
                            NAK 0x15
                            ReadCmd 0x80
                            WriteCmd 0x00
                            // IPD_TYPE 0 // offsets are doubled as FLASH is byte addressable
                            IPD_P1 2
                            IPD_P2 4
                            IPD_P3 6
                            IPD_P4 8
                            IPD_P5 10
                            IPD_P6 12
                            IPD_P7 14
                            IPD_DOWN 16
                            IPD_RELEASE 18
                            IPD_OBJVidx 20
                            // object indexes
                            tDipSwitch 0
                            tKnob 1
                            tRockerSwitch 2
                            tRotarySwitch 3
                            tGSlider 4
                            tTrackbar 5
                            tWinButton 6
                            tAngularmeter 7 // need to implement use of this, inputs must be ordered first
                            tCoolgauge 8
                            tCustomdigits 9
                            tForm 10
                            tGauge 11
                            tImage 12
                            tKeyboard 13 // this is a special input, does not need to be at front
                            tLed 14
                            tLeddigits 15
                            tMeter 16
                            tStrings 17 // also need output strings code
                            // tStringUNI 0x3f | 0x40
                            // tStringANSII 0x3f
                            tThermometer 18
                            tUserled 19
                            tVideo 20
                            tStaticText 21
                            // Remove, check for non visual objects instead
                            // MaxVisObjects 21 // objects that have a visual component
                            tSounds 22
                            tTimer 23
                            tSpectrum 24
                            tScope 25
                            tTank 26
                            tUserImages 27
                            tPinOutput 28
                            tPinInput 29
                            t4Dbutton 30 // more inputs
                            tAniButton 31
                            tColorPicker 32
                            tUserButton 33
                            // tGradient, tBorder, tScale are not real objects, generated totally within Workshop
                            MaxTotObjects 33 // objects in objects array
                            // OT_DISPLAY 22
                            OT_REPORT 100
                            OT_SETCONST 101
                            OT_SETANOTHER 102
                            OT_ACTIVATE 103
                            OT_NEXTFRAME 104
                            OT_PREVFRAME 105
                            OT_NEXTSTRING 106
                            OT_PREVSTRING 107
                            // other OT_s Form activate,
                            // Indexes into LedDigits and CustomDigits arrays
                            ileft 0
                            iDigits 2
                            iMinDigits 4
                            iWidthDigit 6
                            iLeadingBlanks 8
                            // indexes to Strings arrays
                            STStartH 0
                            STStartL 2
                            STSize 4
                            STx1 6
                            STy1 8
                            STx2 10
                            STy2 12
                            STFGColor 14
                            STBGColor 16
                            STFontAttribs 18
                            STTransparent 20 // bit transparent should 'refresh' background, otherwise rectangle out
                            STAnsi 22 // bit defines write/draw routine
                            STForm 24 // form this string can be seen in
                            // Command codes
                            READ_OBJ 0
                            WRITE_OBJ 1
                            WRITE_STR 2
                            WRITE_STRU 3
                            WRITE_CONTRAST 4
                            REPORT_OBJ 5
                            REPORT_EVENT 7
                            // End P1.inc
                            nObjects 3
                            nInputs 2
                            ANITIMERS 0
                            #END

                            #DATA
                            word formstidx 0
                            word formenidx 3
                            word IPControls -1, -1, 0
                            word IPData tGSlider, 1, 32, 727, 70, 90, -1, -1, 22, 0, 2,
                            OT_SETANOTHER, 15, 0, 0, 16, 0, 0, 0, 0, 0, 0
                            word oDipSwitchs 0
                            word oKnobs 0
                            word oRockerSwitchs 0
                            word oRotarySwitchs 0
                            word oGSliders 1, iSlider0
                            word oTrackbars 0
                            word oWinButtons 0
                            word oAngularmeters 0
                            word oCoolgauges 0
                            word oCustomdigitss 0
                            word oForms 1, -1
                            word oGauges 0
                            word oImages 0
                            word oKeyboards 0
                            word oLeds 0
                            word oLeddigitss 1, iLeddigits0
                            word oMeters 0
                            word oStringss 0
                            word oThermometers 0
                            word oUserleds 0
                            word oVideos 0
                            word oStaticTexts 0
                            word oSpectrums 0
                            word oScopes 0
                            word oTanks 0
                            word oUserImagess 0
                            word oPinInputs 0
                            word o4Dbuttons 0
                            word oAniButtons 0
                            word oColorPickers 0
                            word oUserButtons 0
                            word oTimers 0
                            word oSoundss 0
                            word oPinOutputs 0
                            word formBGcol 0x0000
                            word kKeyboardKeystrokes -1
                            word OPDataL 56, 4, 1, 174, 0
                            #END

                            // Start P2.inc
                            var oObjects[MaxTotObjects+1] ; // address of objects
                            var curform ;
                            var x, y ;
                            var inputtype, TState, input, object ;
                            var comRX[40], cmd[CMDLenMAX] ;

                            var cs, Ocs ;

                            func seroutCS(var op)
                            serout(op) ;
                            Ocs ^= op ;
                            endfunc

                            func seroutOcs()
                            serout(Ocs) ;
                            Ocs := 0 ;
                            endfunc

                            func TMul(var p1, var p2, var p3)
                            var var32[2], var322[2] ;
                            umul_1616(var32, p1, *(input+p2)) ;
                            umul_1616(var322, var32[1], *(input+p3)) ;
                            umul_1616(var32, var32[0], *(input+p3)) ;
                            return(var32[1] + var322[0]) ;
                            endfunc

                            func ReadObject(var ObjectType, var ObjectIdx)
                            var j, k, Objects ;
                            Objects := *(oObjects+ObjectType) ;

                            seroutCS(REPORT_OBJ) ;
                            seroutCS(ObjectType) ;
                            seroutCS(ObjectIdx) ;
                            j := 2 + ObjectIdx * 2 + Objects ;
                            if (ObjectType == tForm)
                            k := curform ;
                            else if ((ObjectType == tCustomdigits) || (ObjectType == tLeddigits))
                            k := img_GetWord(hndl, *j, IMAGE_TAG2);
                            else
                            k := img_GetWord(hndl, *j, IMAGE_INDEX);
                            endif
                            seroutCS(k >> 8) ; // first 8 bits
                            seroutCS(k) ;
                            seroutOcs() ;
                            endfunc


                            func WriteObject(var ObjectType, var ObjectIdx, var NewVal)
                            var i, j, k, Objects ;
                            ObjectType &= 0x3f ;
                            if (ObjectType == tForm)
                            ActivateForm(ObjectIdx) ;
                            else
                            Objects := *(oObjects+ObjectType)+ObjectIdx*2+2 ;
                            i := *(Objects) ;
                            if (ObjectType == tLeddigits)
                            img_SetWord(hndl, i , IMAGE_TAG2, NewVal); // where state is 0 to 2
                            ledDigitsDisplay(i, oLeddigitss, OPDataL) ;
                            else
                            img_SetWord(hndl, i , IMAGE_INDEX, NewVal); // where state is 0 to 2
                            img_Show(hndl, i) ; // will only display if form is current
                            endif
                            endif
                            endfunc

                            Comment

                            Working...
                            X