Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 29, 2024, 01:23:22 01:23


Login with username, password and session length


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

Posts: 173

Thank You
-Given: 263
-Receive: 100


« on: July 02, 2017, 05:10:14 17: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: 186

Thank You
-Given: 193
-Receive: 159


In the order is preserved, in the mess is created.


« Reply #1 on: July 02, 2017, 08:40:40 20: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: 173

Thank You
-Given: 263
-Receive: 100


« Reply #2 on: July 02, 2017, 10:46:08 22: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, 02:12:14 14:12 by metal » Logged
o2
Moderator
Hero Member
*****
Offline Offline

Posts: 505

Thank You
-Given: 40
-Receive: 405


Top Topic Starter


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

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

Posts: 173

Thank You
-Given: 263
-Receive: 100


« Reply #4 on: July 03, 2017, 06:26:58 18: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