Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

1wire on extended port not working
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
nisse

Bascom Member



Joined: 14 Dec 2006
Posts: 50

sweden.gif
PostPosted: Sun Jan 13, 2013 9:16 pm    Post subject: 1wire on extended port not working Reply with quote

Hi
I'm trying to use 1wire on pinf.6 but it doesn't work.
Same code works fine on pind.0 and d.1

I have atmega128 in 128 mode, Bascom 2.0.7.6.001
Extended = 1 or 0 makes no difference.
Not using the ADC or jtag

I'm stuck Sad
Any suggestions?

/Andy
Back to top
View user's profile
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Sun Jan 13, 2013 11:34 pm    Post subject: Reply with quote

Hi Andy

did you connect both set of Vcc gnd PIN 21 22 / 52 53 ?

not sure if you need to connect Avcc and gnd to 63 64

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
nisse

Bascom Member



Joined: 14 Dec 2006
Posts: 50

sweden.gif
PostPosted: Mon Jan 14, 2013 7:17 am    Post subject: Reply with quote

yes, there all connected
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5199
Location: Holland

blank.gif
PostPosted: Mon Jan 14, 2013 10:05 am    Post subject: Reply with quote

always try some some code that toggles the pin so you can determine if you can really control the pin :
config portF.6 =output
do
toggle portF.6
waitms 1000
loop

then measrure level of portf.6
also check if timing is correct

_________________
Mark
Back to top
View user's profile Visit poster's website
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Mon Jan 14, 2013 1:18 pm    Post subject: Reply with quote

Just tested in ISIS

PortF.6 not working
but I see that portE.6 is activ ???

if I connect portf.6 and porte.6 to my 1 wire I get data OK

can it be a error in m128def.dat or mcs.lib 1Wire ?

Of cause it can be a internal error in ISIS to !!!

@Edit the error was in ISIS
PINE = $00
PINF = $01

thats wrong

PINE = $01
PINF = $00

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5199
Location: Holland

blank.gif
PostPosted: Mon Jan 14, 2013 1:45 pm    Post subject: Reply with quote

I looked it up:
it will not work for the m128 portF because it has an odd port map :

PINF = $00
PORTF = $62
DDRF = $61

The 1wire depends on the fact that the port/pin/ddr are grouped like pin,ddr,port:
PORTD = $12
DDRD = $11
PIND = $10

it would require a special version of the lib for the m128 portF.

_________________
Mark
Back to top
View user's profile Visit poster's website
nisse

Bascom Member



Joined: 14 Dec 2006
Posts: 50

sweden.gif
PostPosted: Mon Jan 14, 2013 1:54 pm    Post subject: Reply with quote

ok, thanks Mark and Kim, but isn't this what extended=1 is supposed to solve?
/Andy
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5199
Location: Holland

blank.gif
PostPosted: Mon Jan 14, 2013 1:56 pm    Post subject: Reply with quote

no, that only resolve the case where the address is >&HFF. Like $100. In that case R31 must be set too.
_________________
Mark
Back to top
View user's profile Visit poster's website
nisse

Bascom Member



Joined: 14 Dec 2006
Posts: 50

sweden.gif
PostPosted: Mon Jan 14, 2013 2:01 pm    Post subject: Reply with quote

ok ic
How would you suggest I go about getting a special version of the lib for the m128 portF?
/Andy
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5199
Location: Holland

blank.gif
PostPosted: Mon Jan 14, 2013 11:08 pm    Post subject: Reply with quote

- open mcs.lib
- copy the code from [1wire] and put it in a new lib
- then look for the code that uses the PIN register :

for example :
Ld r17,Z ; get PIN register

change that like:
Lds r17, PINF

i think it is used twice.

then use $lib to include the modded lib. that should do it.

_________________
Mark
Back to top
View user's profile Visit poster's website
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Tue Jan 15, 2013 2:03 am    Post subject: Reply with quote

You also need to edit the DDR and PORT
and if you use 1wireserach you must edit [1WIRE_SEARCH] to

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5199
Location: Holland

blank.gif
PostPosted: Tue Jan 15, 2013 10:19 am    Post subject: Reply with quote

it should not be needed to change ddr and port but because PIN address is passed which is 0 , you should add $60 to Z.
you could do that by modding this:

_1wire_set_pin:
ldi r30,$60 ; fixed
clr 31 ; fixed
Ld r16,z+1 ; get DDR register

then you do not need to change ddr/portf code.

_________________
Mark
Back to top
View user's profile Visit poster's website
nisse

Bascom Member



Joined: 14 Dec 2006
Posts: 50

sweden.gif
PostPosted: Tue Jan 15, 2013 2:06 pm    Post subject: Reply with quote

Thanks guys, I'll give it a go.
Haven't done any assembler programming since the 6502, 30 years ago, but its a bit like riding a bike, isn't it Smile
/Andy

PS, does the changes you mention apply to all 1wire routines or just the _1wire_set_pin routine?
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5199
Location: Holland

blank.gif
PostPosted: Tue Jan 15, 2013 2:39 pm    Post subject: Reply with quote

it will work for all since they all use this routine first. so the changes are minimal.
_________________
Mark
Back to top
View user's profile Visit poster's website
nisse

Bascom Member



Joined: 14 Dec 2006
Posts: 50

sweden.gif
PostPosted: Wed Jan 16, 2013 6:57 pm    Post subject: Reply with quote

Sorry guys, stuck again Sad

I've copied the [1_WIRE] part from mcs.lib into a new text file, 1wireF.lib
and use $lib "1wireF.lib" in the code.
When compiling I get .DEF not found and Backward jump out of range Sad

@ lib code removed !
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum