Skip to main content
Visitor II
August 29, 2003
Question

Regarding PB4

  • August 29, 2003
  • 5 replies
  • 1219 views
Posted on August 29, 2003 at 05:31

Regarding PB4

    This topic has been closed for replies.

    5 replies

    bbbodekarAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:55

    Hello,

    1. I am trying to connect a switch to PB4 on the DK3 I have made the necessary changes in the configuration for Port B and in the PSD soft, confiugred the pin to be GPIO. Also i have a 4.7K resistor pullup for PB4 to Vcc2. But still i am not able to get any response from the switch. I am able to use the other switches ( SW4 & SW5 ) which are connected to pins of Port B.

    2. Can i access the Port B from the timer ISR ? I want to read the switch status at a regular interval, and glow the corresponding LED's from timer0 ISR. If i put the code outside timer routine, i am able to do it, but not from timer0 ISR.

    Kindly suggest me how to go for the above problems.

    Regards,

    Bhushan.

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:55

    Can you post the *.abl file in the formus

    bbbodekarAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:55

    Hi,

    Here is the *.abl file

    module trial1

    LCD_d7 PIN 21; ''Reserved for Peripheral I/O mode

    LCD_d6 PIN 22; ''Reserved for Peripheral I/O mode

    LCD_d5 PIN 24; ''Reserved for Peripheral I/O mode

    LCD_d4 PIN 26; ''Reserved for Peripheral I/O mode

    LCD_d3 PIN 28; ''Reserved for Peripheral I/O mode

    LCD_d2 PIN 32; ''Reserved for Peripheral I/O mode

    LCD_d1 PIN 34; ''Reserved for Peripheral I/O mode

    LCD_d0 PIN 35; ''Reserved for Peripheral I/O mode

    LCD_enable PIN 66;

    LCD_rw PIN 67;

    LCD_rs PIN 72;

    SW3 PIN 73; ''GP I/O

    SW2 PIN 74; ''GP I/O

    SW1 PIN 76; ''GP I/O

    LED2 PIN 78; ''GP I/O

    LED1 PIN 80; ''GP I/O

    tdo PIN 6; ''TDO

    tdi PIN 7; ''TDI

    vbaton PIN 9; ''Standby-on indicator

    vstby PIN 15; ''SRAM standby voltage input

    tck PIN 16; ''TCK

    tms PIN 20; ''TMS

    ale PIN 4; ''ALE output

    SCL2 PIN 46; ''I2C bus - Clock

    SDA2 PIN 44; ''I2C bus - Data

    ADC_Ch0 PIN 59; ''ADC channel0 input

    Toggle_pin1 PIN 52; ''GP I/O

    a11 PIN 57; ''Address line

    a10 PIN 55; ''Address line

    a9 PIN 53; ''Address line

    a8 PIN 51; ''Address line

    a7 PIN 47; ''Data/address bus line

    a6 PIN 45; ''Data/address bus line

    a5 PIN 43; ''Data/address bus line

    a4 PIN 41; ''Data/address bus line

    a3 PIN 39; ''Data/address bus line

    a2 PIN 38; ''Data/address bus line

    a1 PIN 37; ''Data/address bus line

    a0 PIN 36; ''Data/address bus line

    _Reset_In PIN 68;

    VREF PIN 70; ''VREF input

    _rd PIN 62;

    _psen PIN 63;

    _wr PIN 65;

    USB_minus PIN 8; ''USB- bus

    USB_plus PIN 10; ''USB+ bus

    Xtal1 PIN 48; ''Xtal1

    Xtal2 PIN 49; ''Xtal2

    psel0 node;

    rs0 node;

    csiop node;

    fs0 node;

    fs1 node;

    fs2 node;

    fs3 node;

    csboot0 node;

    csboot1 node;

    csboot2 node;

    csboot3 node;

    _reset node 543;

    a12 node 512;

    a13 node 513;

    a14 node 514;

    a15 node 515;

    pgr1..pgr0 node;

    X = .x.;

    address = [a15..a0];

    page = [pgr1..pgr0];

    Vcc = 1;

    Gnd = 0;

    // Begin user preserved declarations (not affected by iterations of DA usage) ===================

    // End user preserved declarations (not affected by iterations of DA usage) ===================

    equations

    rs0 = ((address >= ^h2000) & (address <= ^h3FFF));

    csiop = ((address >= ^h0200) & (address <= ^h02FF));

    fs0 = ((page == 0) & (address >= ^h8000) & (address <= ^hFFFF));

    fs1 = ((page == 1) & (address >= ^h8000) & (address <= ^hFFFF));

    fs2 = ((page == 2) & (address >= ^h8000) & (address <= ^hFFFF));

    fs3 = ((page == 3) & (address >= ^h8000) & (address <= ^hFFFF));

    csboot0 = ((address >= ^h0000) & (address <= ^h1FFF));

    csboot1 = ((address >= ^h2000) & (address <= ^h3FFF));

    csboot2 = ((address >= ^h4000) & (address <= ^h5FFF));

    csboot3 = ((address >= ^h6000) & (address <= ^h7FFF));

    psel0 = ((address >= ^h0300) & (address <= ^h03FF));

    LCD_enable = ((address >= ^h0300) & (address <= ^h03FF) & (!_rd))

    # ((address >= ^h0300) & (address <= ^h03FF) & (!_wr));

    LCD_rw = a0;

    LCD_rw.oe = Vcc;

    LCD_rs = a1;

    LCD_rs.oe = Vcc;

    // Begin user preserved equations (not affected by iterations of DA usage) ===================

    // End user preserved equations (not affected by iterations of DA usage) ===================

    end trial1

    Bhushan.
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:55

    Your ABL file is correct. I think you would check your circuit and check if the PB4 is low when the key is pressed.

    Now you read the PB data IN register (csiop + 01).
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:55

    There is good example of how to use PB port and SW1 & SW2 int the following attachment.