From ae10b1c0ffc1384fd944c13e49c6b21a188169c0 Mon Sep 17 00:00:00 2001 From: topicchi Date: Thu, 16 Oct 2025 20:52:17 +0000 Subject: [PATCH] --- trunk/workspace/gcb/tiny13-Temperature.gcb | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 trunk/workspace/gcb/tiny13-Temperature.gcb diff --git a/trunk/workspace/gcb/tiny13-Temperature.gcb b/trunk/workspace/gcb/tiny13-Temperature.gcb new file mode 100644 index 00000000..088a32b7 --- /dev/null +++ b/trunk/workspace/gcb/tiny13-Temperature.gcb @@ -0,0 +1,78 @@ +' ########### start ########### +' avr:tiny13 +' ########### end ########### +' +' ****************************************************************** +' A program to show the temperature level +' 2025-10-09 (c) Paolo Iocco +' ****************************************************************** +' +' Circuit diagram +' --------------- +' ATtiny 13/45/85 Pin map +' +--\/--+ +' +5V>--/Reset---|1° 8|---Vcc--<+5V +' -|2 7|- +' PTH>--ADC2-PB4-|3 6|---PB1--> LED R +' GND>-----GND---|4 5|---PB0--> LED G +' +------+ +' +' ------------------------------------------------------------- +' 9.6MHz: +' LFuse: 0x7A; HFuse: 0x1F; +' AVRDude: avrdude -B 10 -c USBasp -p attiny13 -U lfuse:w:0x7a:m -U hfuse:w:0x1f:m +' +' ****************************************************************** + +' Chip model +#chip tiny13, 9.6 +#define ledR PORTB.0 +#define ledG PORTB.1 +#define ledB PORTB.3 +#define PTH PORTB.4 + +#define S0 107 +#define S1 108 +#define S2 134 +#define S3 159 + +dir ledG out +dir ledR out +dir ledB out + +'Startup routine +Startup: +SET ledG OFF +SET ledR OFF +set ledB OFF + +'Main routine +Loop: + 'Read temperature + 'temp=ReadAD(ADC2) + temp=ReadAD(PTH) + + if temp < S1 then + set ledB ON + SET ledG OFF + SET ledR OFF + end if + if (temp > S1) and (temp S2) and (temp S3 then + set ledB OFF + SET ledG OFF + SET ledR ON + end if + + Wait 100 ms +'Jump back to the start of the program +goto Loop