Digital touch Screen Combination lock


Closed Thread
Results 1 to 40 of 42

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Digital touch Screen Combination lock

    Richard, thanks once again.

    The final version will be under a 12V power supply. So there is no problem thinking about power consumption.

    Physically the final version might have resistors to unused pins pulled to +5V.

    At the moment i'm testing the circuit on breadboard for 3 days and there is no problem at all.

    P.S.

    /Henrik.

    EDIT: One more thing: You're clearly reading PORTB which must mean you're using those five low bits as inputs, yet, at the top of the program you have TRISB = %00000000 which makes all of PORTB outputs...
    So if you use for example the "if"

    Code:
    if LATB.0 = 0
    that mean that we make the port as input? If that so, then what is the way to read the status of the port...."high" or "low" or even the value of the port?

    In the mean time im reading the manual.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,391


    Did you find this post helpful? Yes | No

    Default Re: Digital touch Screen Combination lock

    So if you use for example the "if"

    if LATB.0 = 0
    that mean that we make the port as input? If that so, then what is the way to read the status of the port...."high" or "low" or even the value of the port?
    combined with this continually showing up in your code


    TRISA = %00000000 'use TRISA to specify which pin is (1 = input) and which (0 = output) (ALL pins are output)
    TRISB = %00000000 'use TRISB to specify which pin is (1 = input) and which (0 = output) (RB7 PORTB.7 is the RX input pin of the EUART, the rest are output)
    TRISC = %10000000 'use TRISC to specify which pin is (1 = input) and which (0 = output) (RC7 PORTC.7 is the RX input pin of the EUART, the rest are output)
    'in PORTC the RC3 attached is an LED.


    Code:
    '------------------------------------------------------------------------|
    '--------------------------- TRIS A B C ---------------------------------|
    '------------------------------------------------------------------------|
    ' PORTA.7  PORTA.6  PORTA.5  PORTA.4  PORTA.3  PORTA.2  PORTA.1  PORTA.0 |
    '  bit7     bit6     bit5     bit4     bit3     bit2     bit1     bit0   |
    '   0        0        0        0        0        0        0        0     |
    '------------------------------------------------------------------------|
    '------------------------------------------------------------------------|
    ' PORTB.7  PORTB.6  PORTB.5  PORTB.4  PORTB.3  PORTB.2  PORTB.1  PORTB.0 |
    '  bit7     bit6     bit5     bit4     bit3     bit2     bit1     bit0   |
    '   0        0        0        0        0        0        0        0     |
    '------------------------------------------------------------------------|
    '------------------------------------------------------------------------|
    ' PORTC.7  PORTC.6  PORTC.5  PORTC.4  PORTC.3  PORTC.2  PORTC.1  PORTC.0 |
    '  bit7     bit6     bit5     bit4     bit3     bit2     bit1     bit0   |
    '   1        0        0        0        0        0        0        0     |
    leads me to think there is fundamental lack of understanding here of pic i/o architecture
    and the relation ship between ansel,port,lat and tris registers and their effect on
    pin operations.

    i would recommend a few led flashing exercises to become comfortable with i/o concepts
    Warning I'm not a teacher

  3. #3
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Digital touch Screen Combination lock

    Hi Richard,

    i will try some LED blinks for sure.

    many thanks.

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


    Did you find this post helpful? Yes | No

    Default Re: Digital touch Screen Combination lock

    contrary to popular belief its a tricky subject

    lesson 1 what happens here with and without the nop compiled in ? and why ?
    Code:
    ;rmw test ,a led with a  270 ohm resistor in series to gnd placed each on pin a0 and a1
    #CONFIG
      CONFIG  FOSC = INTIO67
      CONFIG  PLLCFG = OFF
      CONFIG  PRICLKEN = ON
      CONFIG  FCMEN = OFF
      CONFIG  IESO = OFF
      CONFIG  PWRTEN = ON
      CONFIG  BOREN = SBORDIS
      CONFIG  BORV = 190
      CONFIG  WDTEN = ON
      CONFIG  WDTPS = 32768
      CONFIG  CCP2MX = PORTC1
      CONFIG  PBADEN = OFF
      CONFIG  CCP3MX = PORTB5                                
      CONFIG  T3CMX = PORTC0
      CONFIG  HFOFST = ON
      CONFIG  P2BMX = PORTB5
      CONFIG  MCLRE = EXTMCLR
      CONFIG  STVREN = ON
      CONFIG  LVP = OFF
      CONFIG  XINST = OFF
      CONFIG  DEBUG = OFF
      CONFIG  CP0 = OFF
      CONFIG  CP1 = OFF
      CONFIG  CP2 = OFF
      CONFIG  CP3 = OFF
      CONFIG  CPB = OFF
      CONFIG  CPD = OFF
      CONFIG  WRT0 = OFF
      CONFIG  WRT1 = OFF
      CONFIG  WRT2 = OFF
      CONFIG  WRT3 = OFF
      CONFIG  WRTC = OFF
      CONFIG  WRTB = OFF
      CONFIG  WRTD = OFF
      CONFIG  EBTR0 = OFF
      CONFIG  EBTR1 = OFF
      CONFIG  EBTR2 = OFF
      CONFIG  EBTR3 = OFF
      CONFIG  EBTRB = OFF
    #ENDCONFIG
    '    DEFINE DEBUG_REG PORTB
    '    DEFINE DEBUG_BIT 7      ;  if not used for pwr  
    '    DEFINE DEBUG_BAUD 9600
    '    DEFINE DEBUG_MODE 0  
    '  ASM
    
    
    
    
        ANSELA = 0
        DEFINE OSC 64 
        OSCCON = $70
        OSCTUNE.6 = 1
        TRISA = %11111100 
    led1 var lata.0
    led2 var lata.1
    
    
    loopy:
    lata=0
    led2 = !porta.1
    ;@ nop
    led1 = porta.1
    
    
    pause 3000
     
    goto loopy
    Warning I'm not a teacher

Similar Threads

  1. 4 Wire resistive touch screen, Need help
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 16th February 2012, 17:28
  2. combination lock
    By korayfethi in forum Schematics
    Replies: 13
    Last Post: - 23rd May 2007, 20:02
  3. Round Dial, Electronic Combination Lock
    By Pic_User in forum Off Topic
    Replies: 5
    Last Post: - 6th July 2006, 13:34
  4. touch screen
    By micro in forum General
    Replies: 1
    Last Post: - 13th January 2006, 03:39
  5. Touch Screen Wish List!!!
    By Amity in forum PBP Wish List
    Replies: 2
    Last Post: - 15th September 2005, 14:40

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