Showing posts with label stk500. Show all posts
Showing posts with label stk500. Show all posts

Thursday, 10 October 2013

NXP signalling the AVR

I spent an eternity reading PortD instead of PinD. Thank goodness for the power of web searching. Shame everyone programs in C. They are scared of the power.

NXP code


DigitalOut m1(LED1);
DigitalOut m2(LED2);

DigitalInOut DATA(p21);
DigitalInOut CTL(p23);

void set_data(unsigned char i) {
    DATA.write(i);
    m1.write(i);
}

void set_ctl(unsigned char i) {
    CTL.write(i);
    m2.write(i);
}

int main() {
    CTL.output();
    DATA.output();
    
    while(1) {
        set_data(0);
        set_ctl(1);
        wait(3);
        set_data(1);
        set_ctl(0);
        wait(2);
    }
 }

AVR Code

.include "m16def.inc"

; set portB to output
ser r16
out ddrb, r16
clr r16
out portb, r16

; set portD to input with pull-ups
out portd, r16
out ddrd, r16
ser r16
out portd, r16

; do the do
main:
    in r16, pind
    out portb, r16
    rjmp main

Wednesday, 9 October 2013

Getting the AT-Tiny working with the STK500

Fairly simple, follow online instructions.

  1. AT-TINY13 in SCKT3400D1
  2. Connect the ISP6PIN socket to SPROG1 with the 6-pin cable provided
  3. Connect the PORTE/RST to PORTB/PB5 and PORTE/XT1 to PORTB/PB3
  4. Jumpers VTARGET, AREF, RESET, XTAL1, OSCSEL close; others open

Using it is a bit annoying because you have to take the cables on and off to use the pins.