Announcement

Collapse
No announcement yet.

ulcd70dt and uart

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

  • #16
    Hmm, COM0 is always to the same fixed pins, the pin settings are only applicable to COM1 (as per the title of the area where you change the pins), have you changed the setting to COM1?

    The pin settings show up in the main procedure in the 4dGenisS file, immediately after the '// init comms' comment
    Mark

    Comment


    • #17
      so now my little basic progr runs verry fine the host is a 16f877a and the ulcd70dt




      DEFINE OSC 4 '4 MHz crystal snelheid
      INCLUDE "modedefs.bas" ' Include mode
      ADCON1 = 15 ' zet PORT A en PORT E digitaal
      TRISB.5 = 0 'zet portb tot 5 op output
      LED VAR PORTB.1 ' led op poort b.1
      Reset var PORTB.0
      displayout var PORTC.6 ' tx port van pic
      displayin VAR PORTC.7 ' rx port van pic
      controleled VAR BYTE [$6] 'Receive de controle byte van 4dsystems
      LOW RESET 'reset pin op scherm laag voor reset
      PAUSE 20 'tijd voor reset
      HIGH RESET 'continue hoog op reset pin
      LED = 0 'led op uit
      pause 2300 ' tijd voor cls en programma opstart
      MAIN: 'hoofdprogramma
      serout2 displayout , 84 ,[$04,$06,$02]
      'serout2 displayout , 84 ,[$01,$0f,$00,$00,$01,$0f]
      serout2 displayout , 84 ,[$01,$13,$00,$00,$01,$13] 'led 0 aan
      pause 500
      serout2 displayout , 84 ,[$01,$13,$01,$00,$01,$12] ' led 1 aan
      pause 500
      serout2 displayout , 84 ,[$01,$13,$02,$00,$01,$11] 'led 2 aan
      pause 500
      serout2 displayout , 84 ,[$01,$13,$00,$00,$00,$12] 'led 0 uit
      pause 500
      serout2 displayout , 84 ,[$01,$13,$01,$00,$00,$13] 'led 1 uit
      pause 500
      serout2 displayout , 84 ,[$01,$13,$02,$00,$00,$10] ' led 2 uit
      'gosub controlebit 'na 8 instructies ga naar controlebite $6
      ' serout2 displayout , 84 ,[$01,$0f,$00,$00,$01,$0f] 'zet getal 001 op display
      pause 500


      serout2 displayout , 84 ,[$04,$04,$00]


      gosub controlebit

      controlebit:
      SERIN2 displayin,84,[controleled] 'serial in voor opvraag controle byte
      if controleled = $6 then
      high led 'aan van led
      pause 500 'wacht 0/5 sec
      low led 'led bij portb.5
      endif
      pause 1000
      'terug naar main progr
      gosub main









      So Now i will write a variable value in this serout2 statement buth how hi grtz alain

      Comment


      • #18
        Run GTX against your project and update some values using that. That should give you a feel for what you need to do.

        Also look at the Genie user guide and reference manual about how to build the checksum.

        Then you will need to cut some basic code to split words in two ( using shift and and, assuming that is the keyword in your particular basic) and xor to generate the checksum
        Mark

        Comment


        • #19
          Hello All here friends


          after weeks looking my display works fine if a send a data to the lcd if i do a checksum with the 6 (i write a little test progr in basic and i see the leds comming up if the statement is ok

          so now my first question here ) i'm not a c++ member i have a little code that send to a normal display and works also fine the variables are F2 and F3

          so now i will write in picbasic a little code to split the lsb and lsb also checksum from my pic to the ulcd buth my problem are i don't understood not the c++ what must i do for the correct methode

          help me pls thanks a lotssssssss for answer here the code in picbasic to display the value in decimal on a normal lcd like 20*2 characters this is for me not problem just i have no idee how to write it for a ulcd with checsum or make the string corectly for transfer via the com port


          LCDOUT $FE, 1
          first line print to lcd (normal not a ulcd)


          ' LCDOUT #5 'set a 5 to the display
          ' LCDOUT DEC3 F2 'set the variable F2 to lcd with 3 digits
          ' LCDOUT "." 'set a point to the display
          ' LCDOUT DEC3 F3 'set the variable F3 to lcd with 3 digits

          so if a will send a leddigit value i use and works fine like this serout2 displayout , 84 , [$01,$0f,$00,$02,$3f,$33] so the next is serout2 displayout , 84 , [$01,$0f,$00,F2,F3,CHECSUM]

          ho helps me plssssssss

          Comment


          • #20
            It should not be that hard, I think someone posted a basic example here, just cant find it at the moment.

            There is a discussion here but no actual basic code http://forum.4dsystems.com.au/forum/...g-proton-basic.

            I'm sure it can be done, I just don't have basic available to be at the moment
            Mark

            Comment


            • #21
              ok mark i wait if there is somebody ho helps me if i can fix it then i write it to alll the digit or knobs or so wath buth the arduino code is for me ???? looking for to convert the script to basic buth pffffffffffff hihihihihiihihi

              Comment


              • #22
                yes yes yes yes yes its works fine make a little code to display a valeu from a orginal picbasic code its read en write frequentie on a orginal lcd now i was looking how< tp calculate a checsum and also make lsb en msb so this night my pic works verry fine and now i can write all code to of for my ulcd yes yes yes yes

                Comment


                • #23
                  this is my code and works perfectly on a pic16f628 via a 43ptc display


                  here is the code program on 4mhz and hs fuses



                  DEFINE OSC 4 '4 MHz crystal snelheid
                  INCLUDE "modedefs.bas" ' Include mode
                  CMCON=7

                  LED VAR PORTB.5 ' led op poort b.1
                  Reset var PORTB.4
                  displayout var PORTB.0 ' tx port van pic
                  displayin VAR PORTB.1 ' rx port van pic
                  controleled VAR BYTE [$6] 'Receive de controle byte van 4dsystems
                  LOW RESET 'reset pin op scherm laag voor reset
                  PAUSE 40 'tijd voor reset
                  HIGH RESET 'continue hoog op reset pin
                  led = 0 'led op uit

                  pause 3500 ' tijd voor cls en programma opstart

                  DEFINE I2C_SCLOUT 1

                  ' ** DÉFINITION DES ENTREES - SORTIES

                  ' Sorties I2C
                  SCL var PORTB.2 ' SCL sur RB1 (pin 7)
                  SDA var PORTB.3 ' 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)

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


                  ' ** DÉCLARATION DES VARIABLES
                  checkf2 var byte
                  checkf3 var byte
                  checkmeter1 var byte
                  b1 var BYTE
                  b2 var BYTE
                  b3 var BYTE
                  b5 var BYTE

                  F1 var WORD
                  F2 var WORD
                  F3 var WORD
                  msbf2 var word
                  lsbf2 var word
                  msbf3 var word
                  lsbf3 var word
                  msbmeter1 var word
                  lsbmeter1 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=9920 'début à 2200 MHz : 2200 / 0,125 = 17600
                  PAS = 4 ' pas de 125 kHz par défaut

                  EEPROM 0,[$90,$01]


                  '
                  '*** LECTURE DU DECALAGE TMP ***

                  READ 0,TMP_LO 'lit les 8 bits de poids faible
                  READ 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]

                  GOSUB CALCUL
                  GOSUB AFFICHAGE



                  '*** BOUCLE PRINCIPALE ***

                  BOUCLE:

                  checkf2 =$01^$0f^$00^msbf2^lsbf2 'checksum for f2 status
                  msbf2 = f2.highBYTE
                  lsbf2 = f2.LOWBYTE

                  serout2 displayout ,84, [$01,$0f,$00, msbf2,lsbf2,checkf2]
                  SERIN2 displayin,84,[controleled] 'serial in voor opvraag controle byte
                  if controleled = $6 then
                  high led 'aan van led

                  low led 'led bij portb.5
                  endif
                  checkf3 =$01^$0f^$02^msbf3^lsbf3
                  msbf3 = f3.highbyte
                  lsbf3 = f3.lowbyte
                  serout2 displayout ,84, [$01,$0f,$02, msbf3,lsbf3,checkf3]
                  SERIN2 displayin,84,[controleled] 'serial in voor opvraag controle byte
                  if controleled = $6 then
                  high led 'aan van led

                  low led 'led bij portb.5
                  endif


                  BUTTON UP,0,0,0,b1,1,MONTE
                  BUTTON DOWN,0,0,0,b2,1,DESCEND
                  BUTTON MEMO,0,1,0,b5,1,STORE

                  GOTO BOUCLE


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

                  TMP = TMP + PAS
                  IF TMP > 2000 THEN TMP = 0
                  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 = 0

                  RAZ_TMP: TMP = 2000 '600
                  GOTO MAIN

                  CHOIX: '** CHOIX DU PAS

                  IF PAS = 8 THEN SAUTE
                  PAS = PAS*2
                  GOSUB AFFICHE_PAS
                  GOSUB AFFICHAGE
                  GOTO BOUCLE

                  SAUTE:
                  PAS = 8
                  GOSUB AFFICHE_PAS
                  GOTO BOUCLE

                  CALCUL: ' ** CALCUL DE LA FREQUENCE

                  F1= PLL - 8000
                  F2=F1/8 'donne les MHz
                  F3=125*(F1//8)/100 'donne les kHz
                  RETURN

                  AFFICHAGE:







                  serout2 displayout ,84, [$01,$0f,$01,$00,$01,$0E]
                  SERIN2 displayin,84,[controleled] 'serial in voor opvraag controle byte
                  if controleled = $6 then
                  high led 'aan van led

                  low led 'led bij portb.5
                  endif


                  serout2 displayout ,84, [$01,$0f,$00, msbf2,lsbf2,checkf2]
                  SERIN2 displayin,84,[controleled] 'serial in voor opvraag controle byte
                  if controleled = $6 then
                  high led 'aan van led

                  low led 'led bij portb.5
                  endif
                  checkf3 =$01^$0f^$02^msbf3^lsbf3
                  msbf3 = f3.highbyte
                  lsbf3 = f3.lowbyte
                  serout2 displayout ,84, [$01,$0f,$02, msbf3,lsbf3,checkf3]
                  SERIN2 displayin,84,[controleled] 'serial in voor opvraag controle byte
                  if controleled = $6 then
                  high led 'aan van led

                  low led 'led bij portb.5
                  endif
                  RETURN

                  AFFICHE_PAS:

                  RETURN

                  '*** MEMORISATION DE LA FRÉQUENCE

                  STORE:
                  WRITE 0, TMP_LO 'Stocke les 8 bits de poids faible de TMP dans l'EEPROM à l'adresse 0
                  WRITE 1, TMP_HI 'Stocke les 8 bits de poids fort de TMP dans l'EEPROM à l'adresse 1
                  serout2 displayout ,84, [$01,$13,$00,$00,$01,$13]
                  SERIN2 displayin,84,[controleled] 'serial in voor opvraag controle byte
                  if controleled = $6 then
                  high led 'aan van led

                  low led 'led bij portb.5
                  endif
                  pause 2000
                  serout2 displayout ,84, [$01,$13,$00,$00,$00,$12]
                  SERIN2 displayin,84,[controleled] 'serial in voor opvraag controle byte
                  if controleled = $6 then
                  high led 'aan van led

                  low led 'led bij portb.5
                  endif
                  GOTO BOUCLE


                  Comment

                  Working...
                  X