crossbar mapping in 8051

Discussion in 'Embedded Systems and Microcontrollers' started by salohcin, May 24, 2011.

  1. salohcin

    Thread Starter New Member

    May 15, 2011
    6
    0
    i currently doing a project on 8051 using ASM langauge
    i need to have 2 interrupt where if 1 of the push button is press it will hang and pause and another is a master reset
    however i need to map port 1.4,1.5 to int0 to int1 so when the pushbutton is press the program will be interrupt to perform it's service, i know i have to use crossbar but i have no idea on how can i do it.
    can you guys help me by showing me an example of how to eqn the port to the int0/1 and how to Initialisate it.Thanks in advance
     
  2. RiJoRI

    Well-Known Member

    Aug 15, 2007
    536
    26
    "I need to have 2 interrupts where if one of the push buttons is pressed it will hang and pause and another is a master reset."

    "another" -- does this refer to another button press, or to another push button?

    "However i need to map port 1.4,1.5 to int0 to int1 so when the push-button is pressed the program will be interrupted to perform its service, I know I have to use crossbar but I have no idea on how I can do it."

    I am sure this is impossible with the 8051; although a variant may allow it. Why not connect the push-buttons to P3.2 (Int0) and P3.3 (Int1)?

    --Rich
     
    salohcin likes this.
  3. salohcin

    Thread Starter New Member

    May 15, 2011
    6
    0
    the board is a factory made board so i cannot iterally connect the pushbuttons to p3.2(int0) and p3.3(int1) that why i thought of using crossbar if not , can i eqn the push button as p3.2 or any other commands to map the 2 pushbutton need to int0 and int1?
    thanks in advance
     
  4. salohcin

    Thread Starter New Member

    May 15, 2011
    6
    0
    or are there any way to map p1.4 and p1.5 when it pressed(output 1) that it will alway trigger int1 or int0?
     
  5. RiJoRI

    Well-Known Member

    Aug 15, 2007
    536
    26
    No. There is no way to do that.

    IF one of the timers is unused, or if one timer interrupt triggers often enough, you could add code to the ISR to poll the button input. Actually, having a button trip an interrupt is not too good an idea, because of switch bounce which would result in one button press being read as multiple presses.

    --Rich
     
    salohcin likes this.
  6. salohcin

    Thread Starter New Member

    May 15, 2011
    6
    0
    arh i see so it just better to poll buttons if it press jmp to set interrupt?

    hmm so the only way is to use polling to waiting for pushbutton pressed
    btw i use silab c8051f120 i read the data sheet that it can be possible
    would you mind doing an example if i will to use a crossbar? to use crossbar i have to make the button a push-pull and as a digital input right?

    lets say i poll for pushbutton like example

    here:jb p1.1,here
    setb p3.2 ;trigger int0 flag since the pushbutton is pressed


    can i do this to get the result i want?

    lets say i want to make a 50 hz wave, i have to use timer right?
     
    Last edited by a moderator: May 26, 2011
Loading...