Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

ATtiny26L....problems

 
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
grzeniua

Bascom Member



Joined: 03 Jun 2004
Posts: 11
Location: Poland

PostPosted: Tue Jun 08, 2004 1:48 pm    Post subject: ATtiny26L....problems Reply with quote

Hello everybody.

I'm new on this forum so please be polite Smile

My name is Grzegorz and I work for Whirlpool Europe/Poland.
I'm using demo version of Bascom AVR ver. 1.11.7.4 and currently ATtiny microcontrollers. O.K. - I think that's enough for an introduction

I know from internet (don't remember exactly where did I find it) that sometimes Bascom has problems with tiny uC...maybe that's not true but anyway - I have Confused

I've built quite simple board to start with: uC without reset (tiny 26 has a Power-Up reset) and without an external oscillator. I've just connected a LED in serial with 220Ohm resistor to +Vcc and was truing to make it blink (at least - lit) but it doesn't work.....
I've used internal oscillator (Fuse bits) and flash the uC with a simple STK200 programmer (from Bascom Very Happy ). It seem to program correctly because the state on pin is changing (when measured without LED) but WITH LED IT'S DEAD!
Maybe some bits were wrongly set or something else happens....

I'm including the short source code but I'm quite sure that it's correct:

$regfile = "at26def.dat"
$crystal = 1000000

Config Portb = Output
Config Porta = Input

Main:
Do
Portb = 255
Porta = 0
Wait 1
Portb = 0
Porta = 255
Wait 1
Loop

End


That's it...do you have any comments???

Another thing is that I plan to use 1wire iButtons and I would like to ask if it's better to use for example AT89C2051 or ATtiny26. If it doesn't matter (if noone have found any problems with tiny) then I would prefer the AVRs.

Waiting for answers...

_________________
Regards
Grzegorz
Back to top
View user's profile
ZbeeGin

Bascom Member



Joined: 24 May 2004
Posts: 76
Location: Swietochlowice, Poland

poland.gif
PostPosted: Wed Jun 09, 2004 12:48 pm    Post subject: Reply with quote

According to help file the Tiny chips aren't fully supported by BASCOM AVR.

Try to add $TINY directive, but don't expect that your code will work as you wish.
Back to top
View user's profile Visit poster's website
ZbeeGin

Bascom Member



Joined: 24 May 2004
Posts: 76
Location: Swietochlowice, Poland

poland.gif
PostPosted: Sun Jun 13, 2004 1:20 pm    Post subject: Reply with quote

Aiii!!

Ignore my previous reply. $TINY directive applies only to RAM-less chips like Tiny11/12.

First at all, if your LEDs are connected to PORTA you should use: CONFIG PORTA = OUTPUT.
When you configure PORTA as input (just like in your code), PORTA = 255 enable internal pull-ups and PORTA = 0 disable it. So when you measure voltage everythnig seems OK - pin state changes.

If your LEDs are connected to PORTB, make sure that LEDs are fitted correct. Wink
Back to top
View user's profile Visit poster's website
grzeniua

Bascom Member



Joined: 03 Jun 2004
Posts: 11
Location: Poland

PostPosted: Tue Jun 15, 2004 6:46 am    Post subject: Reply with quote

Ok - thanks I'll try but I'm quite sure that I did it correctly. Anyway, maybe it would be better for me to start with '51... We'll see.
_________________
Regards
Grzegorz
Back to top
View user's profile
ZbeeGin

Bascom Member



Joined: 24 May 2004
Posts: 76
Location: Swietochlowice, Poland

poland.gif
PostPosted: Tue Jun 15, 2004 11:51 am    Post subject: Reply with quote

I'm shure, that you wrongly configure PORTA in your program.
Back to top
View user's profile Visit poster's website
Jeremy Wempren

Bascom Member



Joined: 18 Jun 2004
Posts: 8

PostPosted: Sat Jun 19, 2004 12:09 am    Post subject: Reply with quote

why are you even using 2 pins and whats the input for. there is no need for an input in a pure output system.

input is to read data. thats it. output is what you send out thats what will drive your led. remove the input config. and make sure your on the right pins with your circuit.

pin----res--led--vcc
or

pin---led--res--vcc

you can go the other way as well and change vcc for gnd but the output pins can't source alot, still it should be able to drive an led on every pin.

also i think the tiny even with no ram versions will still work with this simple program, it only will flake out if you try in any way to use memory, (ie variables) you can use io locations but not storage of anything very well.


hope this helps

jw
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5319
Location: Holland

blank.gif
PostPosted: Sat Jun 19, 2004 10:57 pm    Post subject: Reply with quote

tiny26 is supported.
Make sure you sink current : connect anode of LED to VCC, kathode of LED to resistor, and other side of resistor to POR PIN.
When you make the pin low, the LEDd should emit light.

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

Bascom Member



Joined: 03 Jun 2004
Posts: 11
Location: Poland

PostPosted: Wed Jun 23, 2004 10:11 am    Post subject: Reply with quote

Hi everybody Wink

In the beginning - thanks for all answers.

I've discovered that there are some problems with programmer. On all schemes I haven't found an option with an external oscillator - I did it and it finally works! Very Happy
The problem was that these uC were previously flashed in a different way and then the communication was lost...

Now everything works but.. I have new problems. Now it's according to 1Wire bus - it doesn't work.

First I've connected the thermometer DS1820 with a pull-up resistor 5,1kOhm and then with 4,3kOhm

The code of procedure (from Elektronika Dla Wszystkich Smile ) that reads the DS1820 is as follows (maybe you can take a look Shocked )

The result is T and 1wire defined as: Config 1wire = Pina.7

*****************************
Sub Readds1820
1wreset
1wwrite &HCC
1wwrite &HBE
Bd(1) = 1wread(9)
1wreset
Tmp = Bd(1) And 1
If Tmp = 1 Then Decr Bd(1)
T = Makeint(bd(1) , Bd(2))
T = T * 50
T = T - 25
T1 = Bd(Cool - Bd(7)
T1 = T1 * 100
T1 = T1 / Bd(Cool
T = T + T1
T = T / 10
End Sub
*****************************

The result is always "-12"

Another thing - I was trying with DS1990 and..guess what! DOESN'T WORK! Crying or Very sad

this is a code (1wire as previously)

*****************************
Do
Waitms 100
1wreset
If Err = 1 Then
Cls
Lcd "No device!" ; Num
End If
Cls
Else
Cls
Call Read_numbers
End If
Loop

Sub Read_numbers
1wwrite &H33
Lcd "reading..."
For R = 1 To 8
Number(r) = 1wread()
Next R

Lcd "number:"
Waitms 1
For R = 1 To 8
Cls
Lcd Number(r)
Wait 2
Next R
End Sub
*****************************

PLEASE - HELP ME!!!

_________________
Regards
Grzegorz
Back to top
View user's profile
grzeniua

Bascom Member



Joined: 03 Jun 2004
Posts: 11
Location: Poland

PostPosted: Wed Jun 23, 2004 12:07 pm    Post subject: Reply with quote

I forgot to add..this could be important: I'm using an internal oscillator (CKSEL = 0001). If I need to use the external oscillator is it O.K. to use 4MHz?

thanks in advance

_________________
Regards
Grzegorz
Back to top
View user's profile
grzeniua

Bascom Member



Joined: 03 Jun 2004
Posts: 11
Location: Poland

PostPosted: Wed Jun 23, 2004 1:11 pm    Post subject: Reply with quote

I've tested with 4MHz XTAL - still dead... Crying or Very sad
_________________
Regards
Grzegorz
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5319
Location: Holland

blank.gif
PostPosted: Fri Jun 25, 2004 11:57 am    Post subject: Reply with quote

It is important that you use the proper crystal. Tiny26 has an internal osc. So when you use 4 MH xtal, make sure the chip runs on this xtal.
Always try to measure this :
$crystal=4000000
config portb=output
do
toggle portb
waitms 1000
loop

Now measure the time. You now if the internal osc runs or the external.
1wire depends on proper xtal/$crystal

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

Bascom Member



Joined: 03 Jun 2004
Posts: 11
Location: Poland

PostPosted: Mon Jun 28, 2004 9:51 am    Post subject: Reply with quote

Thanks a lot - now it works;)
It seems that the port was wrongly configured. I've used to set-up the port this: Config Portb = &B11111101.

However I have a new issue (or just a simple question):
how to display a binary number on LCD, because normally it's decimal displayed.

thank to everybody for your support

_________________
Regards
Grzegorz
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
Page 1 of 1

 
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