Skip to content
Tags

,

Well Here’s Something that Worked!

November 6, 2015

Sometimes it feels like pulling teeth to get the olduino/z working but i did fairly well today.

The video shows the protoboard with the following loop running

void main(){
	while(1){
		digitalWrite(0,ON);
		digitalWrite(1,OFF);
		delayms(500);
		digitalWrite(0,OFF);
		digitalWrite(1,ON);
		delayms(500);
	}
}

The delayms() and digitalWrite functions are crude but they are working with the hardware and josh’s monitor. The delay routine is accessing the millisecond tick count maintained by the monitor to time its delays and the digitalWrite routine is sharing a variable with the monitor’s rs232 routine to maintain the state of the port bits.

#define ON 1
#define OFF 0
unsigned char * __at(0xFFc0) scanptr;
unsigned int __at(0xFFF0) TicCnt;//josh's millisecond count 16 bits
static unsigned char bitval[]={1,2,4,8,16,32,64,128};//bit values

void delayms (unsigned int ms){
	unsigned int newms=TicCnt+ms;
	unsigned int testms=TicCnt;
	while(testms<newms){
		testms=TicCnt;
	}
}

void digitalWrite(unsigned char bit,unsigned char onoff){
	unsigned char bv=bitval[bit];
	if (onoff){
		scanptr[0] |=bv;
	}else{
		*scanptr &= ~bv;
	}
	__asm
	 ld hl,(#0xFFC0)	;pick up scan ptr
	 ld a,(hl)	;pick up current value
	 out (64),a
	 __endasm;
}

The worst annoyance now is that loading any size program is slow and error prone.

Advertisements

From → Olduino/Z

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: