Simple BASIC microcontroller programming question

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.

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


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

Reply to
Loading thread data ...

I know nothing about Bascom but is it possible that this should be pind?


Reply to
Mike Warren

There's a new BASCOM forum at

formatting link
maybe you can find an answer there.

I'm not a BASCOM user but I think you use PORTB for output and PIND for inputs.

Reply to

sommes schrieb:

You want to read 10 Bits therefore one port is not enough (each port has 8 bits only and you use 4 by the DDRB instruction). Please send me a mail which indicates input pins and output pins and I will send you the adapted source.

Best regards, Claus Kuhnel

formatting link
formatting link

Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.