Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 21, 2017, 02:57:04 02:57


Login with username, password and session length


Pages: [1]
Print
Author Topic: attiny13 cant read adc input (isis simulation)with bascom avr  (Read 316 times)
0 Members and 1 Guest are viewing this topic.
picavr
Active Member
***
Offline Offline

Posts: 172

Thank You
-Given: 199
-Receive: 100


« on: July 02, 2017, 06:10:14 18:10 »

the attiny13 cant read adc input (isis simulation)
the programme is writen in bascom avr Embarrassed Embarrassed
Logged
sfiga69
Active Member
***
Offline Offline

Posts: 154

Thank You
-Given: 94
-Receive: 117


those who know, are those who know of not knowing


« Reply #1 on: July 02, 2017, 09:40:40 21:40 »

ADC readings are missing because you miss START ADC.
I tried with Proteus 8.3 Sp2 and Bascom AVR 2.0.7.8 by putting START ADC after CONFIG ADC and the relay outputs change status
Logged
picavr
Active Member
***
Offline Offline

Posts: 172

Thank You
-Given: 199
-Receive: 100


« Reply #2 on: July 02, 2017, 11:46:08 23:46 »

no it work nt ...the adc input is considired like digital input
all two outputs change in a same time...but it must change indepently with a analog input



Code:
$regfile = "attiny13.dat"
$crystal = 4800000
  $hwstack = 10                                             ' default use 32 for the hardware stack

$swstack = 10                                               'default use 10 for the SW stack

$framesize = 10
' $noramclear
'Config Portb = Output
'bit7 6 5 4 3 2 1 0  ...... 1 out ,0 in

  '
  Config Portb = &B11101111
  Config Timer0 = Pwm , Prescale = 1 , Compare A Pwm = Clear Up

   '


       Config Adc = Single , Prescaler = Auto , Reference = Internal
      Start Adc
       Reset Admux.0
       Set Admux.1

  Dim Idd As Word
                                                'Alias Pinb.1
  Relaisout1 Alias Portb.1
   Relaisout2 Alias Portb.3
   Idd = Getadc(2)



Do


 Idd = Getadc(2)

 Waitus 100

 If Idd > 500 Then
 Relaisout1 = 1

  End If
  If Idd < 500 Then
 Relaisout1 = 0

  End If
  If Idd > 800 Then
 Relaisout2 = 1

  End If
  If Idd < 800 Then
 Relaisout2 = 0

  End If

Loop



'rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr


'rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr




End
« Last Edit: July 03, 2017, 03:12:14 15:12 by metal » Logged
o2
Moderator
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 25
-Receive: 404


Top Topic Starter


« Reply #3 on: July 03, 2017, 01:59:35 13:59 »

internal ref=1.1V
Logged
picavr
Active Member
***
Offline Offline

Posts: 172

Thank You
-Given: 199
-Receive: 100


« Reply #4 on: July 03, 2017, 07:26:58 19:26 »

yes yes this is the problem
Config Adc = Single , Prescaler = Auto , Reference = avcc
now it work fine
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC