Connect with us

Simple BASIC microcontroller programming question

Discussion in 'Hobby Electronics' started by sommes, Apr 21, 2006.

  1. sommes

    sommes Guest

    I would like to input 10 bit from port B pin 0, 1, 2, 3 and output it to
    port D pin 2, 3, 4, 5, however, my code seem doesn't work. Could you guy
    please give me some idea and point out the mistake. Thank you very much

    Bascom AVR complier, Atmel AT90S8535.

    The code is shown as below

    $regfile = "8535DEF.dat"
    $crystal = 8000000


    Config Portb = Input
    Config Portd = Output

    Dim R As Word , W As Byte

    Do

    Ddrb = &B11110000 'set pin 0,1,2,3
    as input
    R = Portb

    Ddrd = &B00111100 'set pin 2,3,4,5
    as input
    Portd = R
    Loop
    End
     
  2. sommes

    sommes Guest

    Thank you Alan, I've try to PinB before, but the value seem is not correct.

    Correct output can show from 0-9 in 7 segment display, but this one only can
    only show 0-3.

    I knew it is little bit hard to understand my
    Situation.



    Thanks anyway
     
  3. sommes

    sommes Guest

    Thank you Alan.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-