/** ap_ReadMultiAnalog_2* * Reads an two analog inputs and sends their values over the serial port.* Values are preceeded by an identifier (here letters 'A' and 'B') and after * each value a line break is sent.* * This file is part of the Arduino meets Processing Project.* For more information visit http://www.arduino.cc.** copyleft 2005 by Melvin Ochsmann for Malm University**/// two variables for each input pin to read and store the values int analogInput_1 = 2; int analogInput_2 = 3; int value_1 = 0; int value_2 = 0;// an identifier for each value int id_1 = 'A'; int id_2 = 'B'; void setup() { // declaration of pins modes pinMode(analogInput_1, INPUT); pinMode(analogInput_2, INPUT);// begin sending over serial port beginSerial(9600);}void loop() {// read the values od the analog pins and store them in variables value_1 = analogRead(analogInput_1); value_2 = analogRead(analogInput_2);// print out the variables preceeded by their IDs and followed by a carriage return // (that allows us to know where the values end and when to expect the id) printByte(id_1); printInteger(value_1); printByte(10); printByte(id_2); printInteger(value_2); printByte(10); // and wait shortly to not overload the port/board? delay(10); }
'****************************************************************'* Name : UNTITLED.BAS *'* Author : [select VIEW...EDITOR OPTIONS] *'* Notice : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS] *'* : All Rights Reserved *'* Date : 1/11/2010 *'* Version : 1.0 *'* Notes : *'* : *'****************************************************************' Device declaration Device 16F877A ' Produce code for a 16F877 XTAL = 20 ' Use a 20MHz crystal ADIN_RES = 10 ' Set analog pins ADIN_TAD= FRC ADIN_DELAY=50 ADCON0 = %00000001 ADCON1 = %00001111' Declaration of serial communication Declare HSERIAL_BAUD = 9600 ' Set baud rate to 9600,19200,38400,57600,115200 Declare HSERIAL_RCSTA = %10010000 ' Enable serial port and continuous receive Declare HSERIAL_TXSTA = %00100000 ' Enable transmit and asynchronous mode Declare HSERIAL_CLEAR = On ' Enable Error clearing on received characters ' Declaration of variables Dim BUFFER As Byte ' General storage Dim value_1 As Word Dim value_2 As Word DelayMS 200 ' Wait to stabilize value_1=0 value_2=0'sending analog valuesMain: value_1 = ADIn 0 value_2 = ADIn 1 HSerOut["A",Dec value_1,10] HSerOut["B",Dec value_2,10] DelayMS 10 GoTo Main
' Device declaration Device 16F877A ' Produce code for a 16F877 @CONFIG_REQ @__config HS_OSC & WDT_OFF & PWRTE_ON & BODEN_OFF & LVP_OFF & WRT_OFF & CP_OFF & DEBUG_OFF XTAL = 20 ' Use a 20MHz crystal ADIN_RES = 10 ' Set analog pins ADIN_TAD= FRC ADIN_DELAY=50 ADCON1 = %10000010 ' Right justify analogue result ' Declaration of serial communication Declare HSERIAL_BAUD = 9600 ' Set baud rate to 9600,19200,38400,57600,115200 Declare HSERIAL_RCSTA = %10010000 ' Enable serial port and continuous receive Declare HSERIAL_TXSTA = %00100000 ' Enable transmit and asynchronous mode Declare HSERIAL_CLEAR = On ' Enable Error clearing on received characters ' Declaration of variables Dim BUFFER As Byte ' General storage Dim value_1 As Word Dim value_2 As Word DelayMS 200 ' Wait to stabilize value_1=0 value_2=0'sending analog valuesMain: value_1 = ADIn 0 delayms 100 value_2 = ADIn 1 delayms 100 HSerOut["A",Dec value_1,10] delayms 10 HSerOut["B",Dec value_2,10] DelayMS 10 GoTo Main
wala parin syang output ate...ginamit ko yung USART tool ng mikrobasic pang test...
sis gumamit ka ba ng level converter bago sa USB to serial?
e2 po yung circuit...
parang mali connection mo sis...Dapat cguro ganito (Direct connection) as per you diagramLCD RX ----------- Micro TX (RC6)LCD GND ---------- Micro GndLCD TX ----------- No connectionpag ayaw pa din malamang sira na tx ng pic mo, kasi nagsalubong yong tx to tx
nice... nakakalito din kasi minsan ang max232... be carefull sa tx/rxPC RX------ < Max232 RX >TTL----------- Micro TX (RC6)PC GND ---- Max232 GND --------------- Micro GndPC TX ----- < Max232 TX >TTL----------- Micro RX (RC7
working na din siya sa max232...salamat ng marami ate coolet, may kiss ka sakin kapag nagkita tayo...hehe