Date   

PCB Error and missing sockets #asm_tutorial

 

There is an error on the PCB. The connection between J6 and U6 is just plain wrong.

I used a Dremel Tool to open that trace.

You will need to solder a wire connection from J6[SDA] to the left side of R11, the SDAa line.

The 14 pin sockets I ordered for this project are stuck in the LA basin...I assume

-Diz




Re: 101.ASM Question... #asm_tutorial

ken WA2MZE
 

The AVR has a limited number of data memory addresses that are bit addressable by the SBR and CBR instructions.  Depending on the processor in question all of the CPU registers, and some of the port addresses can be so accessed. 

On 10/22/21 4:52 AM, Gary Scott wrote:

SBR Rd,K Set Bit(s) in Register Rd

CBR Rd,K Clear Bit(s) in Register

Will these do what you want?

W4GNS


On 10/22/21 4:08 AM, Mont Pierce KM6WT wrote:
Ok, I know this is a silly, simple, stupid, (etc) question.. 
But the only dumb questions are the ones not asked, right ?

And, since this is a "tutorial"...

In the following code:

;user init
  ldi   temp1,  $10
  out   DDRB,   temp1   ;make PB4 pin an output

It sets bit PB4 in DDRB, but also clears all the other bits.

How do you set/clear PB4 without altering the other bits?


Thanks,
Mont



Re: Tutorial Kit sold out.

Fred Piering
 

Diz:
I would appreciate it if you would add my name to the list for round 2.
Thanks
Fred
WD9HNU


Lesson#1 ATtiny.101.asm #asm_tutorial

 

Hello All,
Below is the current source code for "lesson#1"
The code only turns on an LED or turns it off...very exciting eh?
Please review and send me some feedback
I am looking for your level of knowledge about ASM so I can tailor this tutorial.
I will add some additional comments withing the code in bold text

; ATtiny.101.asm first line of source code - starts with semicolon to define a comment line
; version 05 Oct 2021
; author: W8DIZ

; Set up the working directory for avra ==> cd ~/Desktop/freddieneil.com/kitsandparts.com/tutorials/ATtiny/101/
"cd" is the linux command for "Change Directory"
On linux, this is my full directory path to the source code: "~/Desktop/freddieneil.com/kitsandparts.com/tutorials/ATtiny/101/"
; cut and paste the desired ASM CODE to the command line on the LINUX TERMINAL PROGRAM to assemble to your source code.

; Assemble the code ==> avra ATtiny.101.asm I use AVRA as my Linux Assembler. Recommend AVRASM2 for Windows.

; To enables PB5 and disable External Reset:
; for ATtiny13, clear bit 0 in Fuse High Byte.
; for ATtiny25/45/85, clear bit 7 in Fuse High Byte.
; Must use high voltage programmer like the dragon_hvsp if PB5 enabled
;PIN#1 on the ATtiny chips is used for RESET and programming of the chip. The pin can be configured as an I/O pin
;but then you will not be able to reprogram the chip unless you have a high voltage programmer like the DRAGON_HVSP
;I use an ATtiny45 chip for a KEYER in the 1Watter and 5Watter transceiver kits and they need the extra I/O pin
;hence I needed to buy the high voltage dragon. 

;  avrispv2 * avrispv2 * avrispv2 * avrispv2 * avrispv2 * avrispv2 * avrispv2 * avrispv2 * avrispv2 * avrispv2 * avrispv2 * 

;The next set of lines are cut and paste commands to upload code to a target e.i. our tutorial PCB.
;I use an interface program called "avrdude" ; free of course.
;I select a line to cut & paste depending on the uP used and the programmer, either avrispv2 or dragon

; avrdude -P usb -p t13 -c avrispv2 -U ATtiny.101.hex
; avrdude -P usb -p t13 -c avrispv2 -U lfuse:w:0x6A:m -U hfuse:w:0xFF:m
; avrdude -P usb -p t13 -c avrispv2 -U ATtiny.101.hex -U lfuse:w:0x6A:m -U hfuse:w:0xFF:m

; avrdude -P usb -p t45 -c avrispv2 -U ATtiny.101.hex
; avrdude -P usb -p t45 -c avrispv2 -U lfuse:w:0x62:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:mView order status here: http://kitsandparts.com/portal.php?id=5E89B9D2.17BD4
; avrdude -P usb -p t45 -c avrispv2 -U ATtiny.101.hex -U lfuse:w:0x62:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:m

; avrdude -P usb -p t85 -c avrispv2 -U ATtiny.101.hex
; avrdude -P usb -p t85 -c avrispv2 -U lfuse:w:0x62:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:m
; avrdude -P usb -p t85 -c avrispv2 -U ATtiny.101.hex -U lfuse:w:0x62:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:m

; dragon_hvsp * dragon_hvsp * dragon_hvsp * dragon_hvsp * dragon_hvsp * dragon_hvsp * dragon_hvsp * dragon_hvsp * dragon_hvsp

; avrdude -P usb -p t13 -c dragon_hvsp -U ATtiny.101.hex
; avrdude -P usb -p t13 -c dragon_hvsp -U lfuse:w:0x6A:m -U hfuse:w:0xFF:m
; avrdude -P usb -p t13 -c dragon_hvsp -U ATtiny.101.hex -U lfuse:w:0x6A:m

; avrdude -P usb -p t45 -c dragon_hvsp -U ATtiny.101.hex
; avrdude -P usb -p t45 -c dragon_hvsp -U lfuse:w:0x62:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:m
; avrdude -P usb -p t45 -c dragon_hvsp -U ATtiny.101.hex -U lfuse:w:0x62:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:m

; avrdude -P usb -p t85 -c dragon_hvsp -U ATtiny.101.hex
; avrdude -P usb -p t85 -c dragon_hvsp -U lfuse:w:0x62:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:m
; avrdude -P usb -p t85 -c dragon_hvsp -U ATtiny.101.hex -U lfuse:w:0x62:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:m


; define ATtiny version here we define the uP we are using

.equ  ATtiny13  = 0   ; Declares the symbol ATtiny13
.equ  ATtiny25  = 0   ; Declares the symbol ATtiny25
.equ  ATtiny45  = 0   ; Declares the symbol ATtiny45
.equ  ATtiny85  = 1   ; Declares the symbol ATtiny85

.nolist nolist is an assembler directive to NOT add the following code to an outpt list file

; conditional assembly: .define .undef .if .ifdef .ifndef .else .elif .endif .error .warning .message 
.if    ATtiny13  ==  1
  .include  "../../include/tn13def.inc"
  .message  "tn13def.inc selected"
.elif  ATtiny25  ==  1
  .include  "../../include/tn25def.inc"
  .message  "tn25def.inc selected"
.elif  ATtiny45  ==  1
  .include  "../../include/tn45def.inc"
  .message  "tn45def.inc selected"
.elif  ATtiny85  ==  1
  .include  "../../include/tn85def.inc"
  .message  "tn85def.inc selected"
.else
  .error  "include file not specified"
.endif

.list re-enable listing

.equ  LED = PB4 PB4 is defined in the include file as ".equ PB4 = 4". I also define it as "LED" hence 4 & PB4 and LED are all the same

; Define register names
; r0 is used by Z-registor

.def  temp1 = r16 Register r16 (aka temp1) is the only work register used in our code
           
.dseg
.org SRAM_START define the start of the DATA SEGMENT

.cseg define the start of teh code segmant
.org 0

; next we define the interrupt vectors for both the ATtiny13 and the ATtiny85 uPs
;the only interrupt vector used is RESET so we define the location in our source code where code execution starts
.if ATtiny13  ==  1
  rjmp  RESET         ; Reset Handler
  reti  ; EXT_INT0    ; IRQ0 Handler
  reti  ; PCINT0      ; PCINT0 Handler
  reti  ; TIM0_OVF    ; Timer0 Overflow
  reti  ; EE_RDY      ; EEPROM Ready Handler
  reti  ; ANA_COMP    ; Analog Comparator Handler
  reti  ; TIM0_COMPA  ; Timer0 CompareA Handler
  reti  ; TIM0_COMPB  ; Timer0 CompareB Handler
  reti  ; WATCHDOG    ; Watchdog Interrupt Handler
  reti  ;	ADC         ; ADC Conversion Handler
.else
  rjmp RESET
  reti                ; External Interrupt 0
  reti                ; Pin change Interrupt Request 0
  reti                ; Timer/Counter1 Compare Match 1A
  reti                ; Timer/Counter1 Overflow
  reti                ; Timer/Counter0 Overflow
  reti                ; EEPROM Ready
  reti                ; Analog comparator
  reti                ; ADC Conversion ready
  reti                ; Timer/Counter1 Compare Match B
  reti                ; Timer/Counter0 Compare Match A
  reti                ; Timer/Counter0 Compare Match B
  reti                ; Watchdog Time-out
  reti                ; USI START
  reti                ; USI Overflow
.endif

;On reset, the first thing that should always be done is to define the STACK POINTER.
;The stack pointer is an internal pointer defined as a RAM location.Normally we set the stack
;to the highest available static ram location because when we use it, it is automatically decremented
;and we want the stack pointer to be stored in static ram. You may wish to read further on teh STACK POINTER
;as it is analogous to an Orchestra Director.
RESET:  ;init everything here - Main program start
  ldi   temp1,  low(RAMEND)
  out   SPL,    temp1 ; Set stack pointer to last internal RAM location
.if   ATtiny13  ==  0  
  ldi   temp1,  high(RAMEND)
  out   SPH,    temp1
.endif

;user init
  ldi   temp1,  $10 This forces all PortB I/O pins to be inputs EXCEPT PB4 - physically pin#3 on the ATtiny chips
  out   DDRB,   temp1   ;make PB4 pin an output

main:	  ; main program We loop here and do nothing except force the output pin to be either hi or lo hence turn an LED off or on respectively
  cbi   PORTB,  LED ;	turn LED on
;  sbi   PORTB,  LED ; turn LED off
  rjmp  main
;;;;;;;;;;;;;;;;;;;;;; end of source code ,,,,,,,,,,,,,,,,,,,



Re: 103.ASM Question #asm_tutorial

 

Not a test intentionally :)

This is the current code in 103.asm:

RESET:  ;init everything here - Main program start
  ldi   temp1,  low(RAMEND)
  out   SPL,    temp1 ; Set stack pointer to last internal RAM location

The code was written for at ATtiny13A which has a small RAM space less that 0x100 bytes so only the SPL needed be set.

Check the include file for the ATtiny13 and you'll find: .equ    SRAM_SIZE    = 64

Later I decided to use modify the source code for larger ATtiny chips like the Attiny85 which has .equ    SRAM_SIZE    = 512

So we need to change the source to to handle both with conditional code:

RESET:  ; init stack pointer
  ldi   temp1,  low(RAMEND)
  out   SPL,    temp1 ; Set stack pointer to last internal RAM location
.if ATtiny13  ==  1
.elif  ATtiny25  ==  1
.else
  ldi   temp1,high(RAMEND)
  out   SPH,temp1
.endif

--Diz


On 10/22/21 5:28 AM, Mont Pierce KM6WT wrote:
Diz, is this a test?

It looks like 103.ASM is missing the code to set the "SPH" stack pointer register.

Or am I missing something?


Thanks,
Mont


103.ASM Question #asm_tutorial

Mont Pierce KM6WT
 

Diz, is this a test?

It looks like 103.ASM is missing the code to set the "SPH" stack pointer register.

Or am I missing something?


Thanks,
Mont


Re: 101.ASM Question... #asm_tutorial

Gary Scott
 

SBR Rd,K Set Bit(s) in Register Rd

CBR Rd,K Clear Bit(s) in Register

Will these do what you want?

W4GNS


On 10/22/21 4:08 AM, Mont Pierce KM6WT wrote:
Ok, I know this is a silly, simple, stupid, (etc) question.. 
But the only dumb questions are the ones not asked, right ?

And, since this is a "tutorial"...

In the following code:

;user init
  ldi   temp1,  $10
  out   DDRB,   temp1   ;make PB4 pin an output

It sets bit PB4 in DDRB, but also clears all the other bits.

How do you set/clear PB4 without altering the other bits?


Thanks,
Mont


101.ASM Question... #asm_tutorial

Mont Pierce KM6WT
 

Ok, I know this is a silly, simple, stupid, (etc) question.. 
But the only dumb questions are the ones not asked, right ?

And, since this is a "tutorial"...

In the following code:

;user init
  ldi   temp1,  $10
  out   DDRB,   temp1   ;make PB4 pin an output

It sets bit PB4 in DDRB, but also clears all the other bits.

How do you set/clear PB4 without altering the other bits?


Thanks,
Mont


Re: Atmel Studio assembler versions? #asm_tutorial

ken WA2MZE
 

Some processors are easy to write assembler code for.  The 8086 family for example (as well as AVR, and ARM).  These processors have lots of general purpose registers, and many addressing modes that support tables and arrays in memory.  I wrote a multi port communications controller in assembler for a board that had an embedded 80188 processor on it.  Some fellow engineers suggested that I use "C", or even ADA (that was actually a new thing at the time).   However, it was actually easier to write the code for this in assembler, than C as I needed close contact with the hardware to debug this thing.

Other processors are a PITA to program in assembler, such as the baseline PICs.  They have few registers, few addressing modes, and even bank switched memory maps that get in the way.  These processors don't play well with C compilers either.  Both AVR and ARM processors are well supported by the GNU GCC compilers. 

C++ is a very complex language, if you try to make use of the full breadth of its features.  Arduino only makes use of class objects to construct drivers for various hardware.  They don't go deep down the rabbit hole with 'destructors', 'copy constructors', virtual functions, and such.  Therefore the extra overhead that C++ usually piles on top of C isn't an issue here.

On 10/21/21 3:55 PM, Mont Pierce KM6WT wrote:
On Thu, Oct 21, 2021 at 12:02 PM, w8diz wrote:

For those that want to know why I use ASM...

I built my first computer circa 1975...it was a SWTPC 6800 uP computer with 4K Ram

Only way to talk to the machine was via Machine Code...ASM was not available as far as I know.

Actually wrote an inventory program using machine code.

Then Bill Gates wrote 4KBASIC for the 6800...the rest is history.

I also do "C" but my brain works in ASM...I like knowing where every electron flows in my code.

I started my Embedded Systems Programmer career with the 8051 microcontroller, and Keil C51 Compiler.

While I've played with several types of processors, and usually have fun making the C compiler output Assembly code just for comparison, and to see if I could optimize it further, I've always found the C compilers very efficient.  (i.e. "I" could not optimize further...).

Comparing C to C++, though, I'd never (in most instances) try to use C++ for an embedded system microcontroller environment..  just too much overhead...   However, I do currently have Si5351 VFO project in Atmel Studio 7, in C++, just for fun.

I've also ported my Si5351 VFO project to the Pi PICO and MS Visual Code compiler environment.  It's hard to beat a $4 Pi PICO microcontroller board, for price and fun. 

Except, I'm finding Diz's Challenge of using the ATtiny and bare bones application are just too hard too pass up.  :)  :)

The ATtiny (i.e. AVR family) is a bit more challenging then the simple 8051.  So am greatly looking forward to this project.


Always fun to program down to the bare metal.  !!!


73
km6wt



Re: videoconferences (voice and video)

Mont Pierce KM6WT
 

On Thu, Oct 21, 2021 at 12:40 PM, w8diz wrote:

Anyone around and have time to test teleconferencing? using https://whereby.com/qrp

 

I tried, but could not hear anyone...  Not sure if you could hear me.

I was using Firefox on my phone.   Not sure why it didn't work.  All indications looked like it should have.

Any chance of moving this to Zoom?  I use it often on my phone (and laptop) with No Issues.



73
km6wt


Re: Atmel Studio assembler versions? #asm_tutorial

WA1EDJ
 

Thanks Diz.  I do want to stick with WIN as I do not want to go down the Linux rabbit hole right now.  I can sometimes go WAY astray on projects that spawn projects. 

I'm sure someone out there in the group knows.

I built several of the SWTP 6800's.  Love them.  Along with Altairs ( which I still have an 8800 in a box )  and many other microcomputers of the day.
The ATMEGA328P looks like a Cray compared to those old machines.

TNX!
Bob
EDJ


On Thu, Oct 21, 2021 at 3:02 PM w8diz <w8diz@...> wrote:

Hi Bob,


Thanks for posting about windows versions of AVRASM

I have both Linux and Windows version of AVRASM2 available at http://kitsandparts.com/tutorials/assemblers/

Note that I am a 100 percent Linux user and can not help much with Windows tools etc but "ASM is ASM" no mater the operating system.

Using Linux, my favorite assembler (for simplicity) is AVRA which is available at most local grocery stores.


For those that want to know why I use ASM...

I built my first computer circa 1975...it was a SWTPC 6800 uP computer with 4K Ram

Only way to talk to the machine was via Machine Code...ASM was not available as far as I know.

Actually wrote an inventory program using machine code.

Then Bill Gates wrote 4KBASIC for the 6800...the rest is history.

I also do "C" but my brain works in ASM...I like knowing where every electron flows in my code.


-Diz "ASM is ASM"


On 10/21/21 2:24 PM, WA1EDJ wrote:
While doing some digging on Atmel Studio, I think I found that Studio 4 uses AVRASM while the later Studio's use AVRASM2.
I believe AVRASM2 makes use of preprocessor directives while AVRASM did not.  I guess they both can use assembler directives.
I like the idea of preprocessor directives. 
This means I need to load Studio 5 or later?   I liked Studio 4 since it seemed a bit smaller, less bloated.  
There is a lot to dig through with these AVRs.  BTW - I did want to stick with some WIN version of Studio since there is nice IDE based debug

Correct me if I've got this wrong!

TNX!
Bob
WA1EDJ


Re: videoconferences (voice and video)

Mont Pierce KM6WT
 

On Thu, Oct 21, 2021 at 12:40 PM, w8diz wrote:

Will wait until 1600 EDT

 

What time is that in GMT time ?


73
km6wt


Re: Atmel Studio assembler versions? #asm_tutorial

Mont Pierce KM6WT
 

On Thu, Oct 21, 2021 at 12:02 PM, w8diz wrote:

For those that want to know why I use ASM...

I built my first computer circa 1975...it was a SWTPC 6800 uP computer with 4K Ram

Only way to talk to the machine was via Machine Code...ASM was not available as far as I know.

Actually wrote an inventory program using machine code.

Then Bill Gates wrote 4KBASIC for the 6800...the rest is history.

I also do "C" but my brain works in ASM...I like knowing where every electron flows in my code.

I started my Embedded Systems Programmer career with the 8051 microcontroller, and Keil C51 Compiler.

While I've played with several types of processors, and usually have fun making the C compiler output Assembly code just for comparison, and to see if I could optimize it further, I've always found the C compilers very efficient.  (i.e. "I" could not optimize further...).

Comparing C to C++, though, I'd never (in most instances) try to use C++ for an embedded system microcontroller environment...  just too much overhead...   However, I do currently have Si5351 VFO project in Atmel Studio 7, in C++, just for fun.

I've also ported my Si5351 VFO project to the Pi PICO and MS Visual Code compiler environment.  It's hard to beat a $4 Pi PICO microcontroller board, for price and fun. 

Except, I'm finding Diz's Challenge of using the ATtiny and bare bones application are just too hard too pass up.  :)  :)

The ATtiny (i.e. AVR family) is a bit more challenging then the simple 8051.  So am greatly looking forward to this project.


Always fun to program down to the bare metal.  !!!


73
km6wt


videoconferences (voice and video)

 

Hi Al,

Anyone around and have time to test teleconferencing? using https://whereby.com/qrp

Will wait until 1600 EDT

TIA, Diz



Tutorial Kits Shipping Update

 

Hi All,

12 Kits shipped today.  Those shipped today will receive US Post Office tracking info today.

Remaining kits will ship next Monday or Tuesday, pending Mouser order for 74HCU04 ICs

-Diz


Re: Atmel Studio assembler versions? #asm_tutorial

 

Hi Bob,


Thanks for posting about windows versions of AVRASM

I have both Linux and Windows version of AVRASM2 available at http://kitsandparts.com/tutorials/assemblers/

Note that I am a 100 percent Linux user and can not help much with Windows tools etc but "ASM is ASM" no mater the operating system.

Using Linux, my favorite assembler (for simplicity) is AVRA which is available at most local grocery stores.


For those that want to know why I use ASM...

I built my first computer circa 1975...it was a SWTPC 6800 uP computer with 4K Ram

Only way to talk to the machine was via Machine Code...ASM was not available as far as I know.

Actually wrote an inventory program using machine code.

Then Bill Gates wrote 4KBASIC for the 6800...the rest is history.

I also do "C" but my brain works in ASM...I like knowing where every electron flows in my code.


-Diz "ASM is ASM"


On 10/21/21 2:24 PM, WA1EDJ wrote:
While doing some digging on Atmel Studio, I think I found that Studio 4 uses AVRASM while the later Studio's use AVRASM2.
I believe AVRASM2 makes use of preprocessor directives while AVRASM did not.  I guess they both can use assembler directives.
I like the idea of preprocessor directives. 
This means I need to load Studio 5 or later?   I liked Studio 4 since it seemed a bit smaller, less bloated.  
There is a lot to dig through with these AVRs.  BTW - I did want to stick with some WIN version of Studio since there is nice IDE based debug

Correct me if I've got this wrong!

TNX!
Bob
WA1EDJ


Re: Tutorial Kit sold out.

Kirby Kirby
 

On 10/21/21 17:06, w8diz wrote:
If I receive emails to create 10 more, I'll do so,
Please put me down for one as well.

--


Atmel Studio assembler versions? #asm_tutorial

WA1EDJ
 

While doing some digging on Atmel Studio, I think I found that Studio 4 uses AVRASM while the later Studio's use AVRASM2.
I believe AVRASM2 makes use of preprocessor directives while AVRASM did not.  I guess they both can use assembler directives.
I like the idea of preprocessor directives. 
This means I need to load Studio 5 or later?   I liked Studio 4 since it seemed a bit smaller, less bloated.  
There is a lot to dig through with these AVRs.  BTW - I did want to stick with some WIN version of Studio since there is nice IDE based debug

Correct me if I've got this wrong!

TNX!
Bob
WA1EDJ


Re: Tutorial Kit sold out.

Don K5DW
 

Diz,

I'm a bit late to the party so add me to the list for any additional boards that may be available.

Thanks,
Don Wines, K5DW


On Thu, Oct 21, 2021 at 11:06 AM w8diz <w8diz@...> wrote:
All 20 tutorial kits a gone.

If I receive emails to create 10 more, I'll do so,

else wait for the next generation of tutorials using an ATmega328P.

-DIz








Tutorial Kit sold out.

 

All 20 tutorial kits a gone.

If I receive emails to create 10 more, I'll do so,

else wait for the next generation of tutorials using an ATmega328P.

-DIz

1 - 20 of 588