A tft addin for pbp3


Closed Thread
Results 1 to 40 of 142

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,635


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    when a repeat enabled button is "held" it returns a BUTTON_STATE of 5
    this can be the led "on" cue

    when the button is "released" it returns a BUTTON_STATE of < 5 (1 or 2 )
    this can be the led "off" cue


    Code:
    LOP:
        GOSUB  CK_BUTTON
        IF      BUTTON_STATE[0]   THEN
           IF      BUTTON_STATE[0] >4 then
               PORTD.0=1
           else
               PORTD.0=0 
               BUTTON_STATE[0]=0
           endif   
        endif
    goto lop

  2. #2
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    when I press a button and hold it the led diode is on.That is OK.when I release a button led is off.
    Is it possible to make that when the button is pressed and hold, led is on, and when I connect 5V to pin PORTD.7 then led is off.
    I dont now how to explain a problem.
    When I press a button window is opening and when it is full open then he must stop .Stop signal is connect to PORTD.7



    '-----------------------OPEN WINDOW ------------------------------------------------------
    IF BUTTON_STATE[2] THEN
    IF BUTTON_STATE[2] >4 then
    PORTD.0=1
    else
    PORTD.0=0
    BUTTON_STATE[2]=0
    endif
    endif

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,635


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    you could do this but ..............
    a big if

    is the portd.7 signal is a limit switch or an emergency stop switch ?... if it is then its best done in hardware a hung loop here could cause fire/smoke/damage or hurt


    '-----------------------OPEN WINDOW ------------------------------------------------------
    IF BUTTON_STATE[2] THEN
    IF BUTTON_STATE[2] >4 then
    if PORTD.7 ==0 then
    PORTD.0=1
    else
    PORTD.0=0
    endif
    else
    PORTD.0=0
    BUTTON_STATE[2]=0
    endif
    endif

  4. #4
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    the portd.7 signal is a limit switch for max position of open window.He must disable opening,but if something goes wrong I will put a second hardware switch to disable motor.
    On test board this routine works good.

  5. #5
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    I am stuck with serin2 and serout2 comands.

    I use PIC18F252 for reading sensor.
    BMP085 for temperature and pressure
    DS3231 for time and date
    BH1750 for light intensity
    DHT11 for humidity

    All this values I have on 2x16 LCD and it work perfect.

    pressure and temperature showing on lcd like this


    'DISPLAY true temperature in C
    lCTemp = (B5 + 8) / 16 'Hey presto, lCTemp appears...
    INTEMP = lCTemp / 10 'find value above decimal point
    INTEMPOSTATAK = lCTemp // 10 'Find decimal value
    LCDOut $fe,$c0+12, DEC2 INTEMP, ".", DEC2 INTEMPOSTATAK





    'DISPLAY true pressure in hPa
    lPres = lPres + (X1 + X2 + 3791) / 16 'lPres is the true pressure in Pa
    X1 = lPres / 100+16
    PRITISAK = X1 'find value above decimal point
    PRITISAKOSTATAK = lPres // 100 'find value below decimal point
    LCDOut $fe,$80+9 , DEC PRITISAK, "." ,DEC2 PRITISAKOSTATAK








    Now I want to send all this values to TFT lcd with SEROUT2/SERIN2 commands

    Transminter:

    B2400 Con 16780
    lPres var long
    lCTemp var long

    Sec VAR word
    Mins VAR word
    hr VAR word
    date VAR WORD
    mon VAR WORD
    yr VAR WORD

    PRITISAK VAR WORD
    INTEMP VAR WORD
    DHT_Humidity var word
    lux var word



    Serout2 PortC.7,B2400,["#OK",HR,MINS,SEC,DATE,MON,YR,INTEMP, PRITISAK,DHT_HUMIDITY,LUX]




    On receiver side i have this:

    create two buttons and write receive info on screen


    B240 Con 16780
    cnt var WORD
    HR var WORD
    MINS var WORD
    SEC var WORD
    DATE var WORD
    MON var WORD
    YR var WORD
    LCTEMP var WORD
    LPRES var WORD
    DHT_HUMIDITY var WORD
    LUX var WORD
    buff var byte[32]





    LOP2:

    GOSUB CK_BUTTON
    '*******SET BUTTON FOR ADJUST TIME AND DATE******************************
    IF BUTTON_STATE[0]=1 THEN
    PAUSE 1000
    BUTTON_STATE[0]=0
    ENDIF

    '************NEXT BUTTON GO TO NEXT SCREEN *****************************
    if BUTTON_STATE[1]=1 then
    GOTO SCREEN_1
    BUTTON_STATE[1]=0
    endif

    Serin2 PORTC.0,B2400,10,LOP2,[wait ("#OK"),HR,MINS,SEC,DATE,MON,YR,LCTEMP, LPRES,DHT_HUMIDITY,LUX]

    TEXTSIZE=2
    bg=0
    fg=$7FF
    ' LR UD
    GLCDC 10,200
    GLCDC "Time : "
    ARRAYWRITE buff,[dec2 HR,0]
    GLCDSTR 70,200,buff

    ARRAYWRITE buff,[dec2 MINS,0]
    GLCDSTR 100,200 ,buff

    ARRAYWRITE buff,[dec2 SEC,0]
    GLCDSTR 130,200 ,buff

    GLCDC 10,170
    GLCDC "Date : "

    ARRAYWRITE buff,[dec2 DATE,0]
    GLCDSTR 70,170 ,buff

    ARRAYWRITE buff,[dec2 MON,0]
    GLCDSTR 100,170 ,buff

    ARRAYWRITE buff,[dec2 YR,0]
    GLCDSTR 130,170 ,buff

    ARRAYWRITE buff,[DEC4 LCTEMP,0]
    GLCDSTR 10,100 ,BUFF

    ARRAYWRITE buff,[ DEC4 LPRES,0]
    GLCDSTR 100,100 ,BUFF

    ARRAYWRITE buff,[dec3 DHT_HUMIDITY,0]
    GLCDSTR 200,100,buff

    ARRAYWRITE buff,[dec4 LUX,0]
    GLCDSTR 270,100 ,buff


    GOTO LOP2


    Hr,mins,sec,date,mon,yr and temp are OK

    Pressure are not OK, I have on screen 0235

    Lux and humidity still not connected on transmiter side I have 0 readings

  6. #6
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    I just tested a humidity sensor and his value are correct on lcd and TFT but value of lux are ok if are they below 255.
    How to send variable word size over serout2 commands,I think this is my problem.

  7. #7
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Solved,

    receive:
    Serin2 PORTC.0,B2400,10,LOP2,[wait ("#OK"),HR,MINS,SEC,DATE,MON,YR , LCTEMP.highbyte,lctemp.lowbyte , LPRES.highbyte,lpres.lowbyte ,_
    vlaga ,vlagaostatak,lux.highbyte,lux.lowbyte ]


    transmit

    Serout2 PortC.7,B2400,["#OK",HR,MINS,SEC,DATE,MON,YR,lCTemp.highbyte,lCTe mp.lowbyte, pritisak.HighByte, pritisak.LowByte,vlaga,_
    vlagaostatak,LUX.HighByte,lux.LowByte]

Similar Threads

  1. Replies: 0
    Last Post: - 25th September 2013, 18:33
  2. code examples / libraries for ILI9320 2.8" TFT LCD Module
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 6th June 2013, 08:50
  3. I really need some help with PBP3
    By Ramius in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th February 2012, 16:05
  4. What's with PBP3?
    By BrianT in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th August 2011, 17:09
  5. Experience of driving TFT screens?
    By isaac in forum General
    Replies: 1
    Last Post: - 26th September 2008, 00:15

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