Pins, ports and variables


Results 1 to 8 of 8

Threaded View

  1. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Pins, ports and variables

    Hi Malcom,
    I messed with your code some & tried it on a 16F690
    it compiles, dont know if it works though
    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
    DEFINE OSC 4
    
    
    DEFINE DEBUG_MODE  0    ' Debug sending True serial data
    DEFINE DEBUG_REG_PORTA  ' Debug Port = PortA as required by PICKIT2 serial Monitor
    DEFINE DEBUG_BIT 0      ' Debug.bit = PortA.0
    DEFINE DEBUG_BAUD 9600  ' Default baud rate = 9600
    DEFINE DEBUGIN_REG PORTA' Debug Port = PortA as required by PICKIT2 serial Monitor 
    DEFINE DEBUGIN_BIT 1    ' Debugin bit PortA.1
    DEFINE DEBUGIN_BAUD 9600' Default baud rate = 9600
    DEFINE DEBUGIN_MODE 0   ' Debugin receiving data true = 0 inverted = 1
    
    dht_data  var bit[4]
    dht_data0 var PORTc.0             ' RH sensor connected to pin A0
    dht_data1 var PORTc.1             ' RH sensor connected to pin A1
    dht_data2 var PORTc.2             ' RH sensor connected to pin A2
    dht_data3 var PORTc.3             ' RH sensor connected to pin A3
    y   var byte
    dht var byte
    
    for y =0 to 3
    'TRISc.0 = 0 '
    high dht_data[y]
    low  dht_data[y] : pause 180   ' send 18ms low
    high dht_data[y] : pauseus 300 ' send 30us hi
    TRISc = %00001111
    PulsIn PORTA[y], 1, dht
    debug dht
    next y
    Last edited by Archangel; - 3rd April 2015 at 22:22.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Replies: 2
    Last Post: - 12th November 2014, 07:57
  2. Multiple Variables - Pins
    By GatorGuy in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st February 2010, 01:08
  3. Variables and port pins
    By PeterReed in forum mel PIC BASIC
    Replies: 2
    Last Post: - 22nd September 2009, 14:01
  4. accessing ports pins using an index variable
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th March 2008, 20:36
  5. PIC - 8 Pins - 6 Output Pins ?
    By DanPBP in forum Off Topic
    Replies: 0
    Last Post: - 22nd October 2007, 00:23

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