Tuesday, February 28, 2006

w_4 Analog output




Please click the image to start.

I have to figure out what I did.

w_3 variables & analog input_code from Michael

'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : Mike Reger *
'* Notice : Copyright (c) 2006 Mikro In Control *
'* : All Rights Reserved *
'* Date : 2/28/2006 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
DEFINE OSC 4

DEFINE ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS

ADCvar VAR WORD ' Create variable to store result

TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000010 ' Set PORTA analog and right justify result
Pause 500 ' Wait .5 second

main:
ADCIN 0, ADCvar ' Read channel 0 to adval
serout2 PORTC.6, 16468, [DEC ADCvar, 13, 10] ' print it to serial out,
' with linefeed and carriage return (10, 13)
GoTo main ' Do it forever

Tuesday, February 21, 2006

w_3_Analog Input




Through labs of digital input and analog input, I learned how to wire circuit with microcontroller.
After reading an explanation of microcontroller chip, I figured out how it works.
For this lab of analog input, I succeeded in transmitting data through DB9 serial connector.
By adjusting potentiometer, I varied current flow, and accordingly data values transmitted to a computer.
Yet I could not make my own code. I will keep trying to code my own.

w_2_success after burning_2




I figured out why my microcontroller was burned at the first attempt. Comparing pictures of success and ones of being burned shows the reason. The failed one is circuited wrong. One end should be connected to power and the other to the ground. But the failed one did not give the circuit way out. That is what made the circuit banged.
On the successful circuit, I had current flowing indefinitely, finally 2 LEDs blinking.

The other issue I have been sticking around was how to supply a microcontroller with power. I thought "input" in a pic programming and 5-volt power supply in the diagram was identical. So I kept trying to power the microcontroller with only one input - that is onto the middle of microcontroller. I was wrong.

After a few weeks of lazy and foolish attempts, I finally made it. I owe many thnaks to Kazu.

You must have unequal voltage to have electricity happily tour around a circuit. I was among few who didn't realize it.

w_2_success after burning

w_2_Lab_code from Michael's Phycom syllabus

'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2006 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 2/21/2006 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
DEFINE OSC 4 'Define the clock speed

'set the jobs of the different pins
output portd.1
output portd.0
input portd.2


broc:

if portd.2 = 1 then 'if the switch is pushed
low portd.1 'turn on one LED
high portd.0 'and off the other
else 'if the switch is not pushed
high portd.1
low portd.0
endif



goto broc 'go back to the beginning and do it again

Wednesday, February 08, 2006

reading_Emotion & design by Don Norman

Response to “Emotion & Design: Attractive things work better” by Don Norman


Norman rightly explains that how good designs affect our ‘affect’. Adding a few to his examples, food tastes better served in fancy plates on candle light dining table. When put on clothes that I have coveted long, I feel more confident.
He also mentioned “good human-centered design” enhances cognitive concentrations helping avoid distractions. To extend his understanding, safety tools such as goggles, gloves and helmets are not alone protecting us from hazards. The design stimulating ‘negative affect’ will increase our safety alertness.
So when you work on power tools in Phycom shop, try to be as on ‘negative affect’ as possible to keep you unharmed.

Tuesday, February 07, 2006

free samples