February 22, 2005

notes on annotated space

who owns all generated the data?

what exactly is this "community" thing and why are multinational corporations so interested in funding it?

are any of these applications worth the trade off of constantly broadcasting ones location?

are these tools of liberation or control? or something else entirely?

why do none of the sites ever address the issue of the political?

Posted by William Blaze at 02:46 PM | TrackBack

February 15, 2005

its sort of ping pong code

most of my energy went to creating a system where the pics listen to both the xport and a computer serial connection at the same time sans server. no love. still some things worth exploring but I gave up for the moment to make some ping pong. 10 minutes of contemplating how to keep servos going while the serin2 keeps interupting the code was enough for now, this thing just powers leds. It starts in xport to xport mode, listens for a connection, then gives control of one serin to a computer. Using the computer you can trigger an infinite ping pong loop between two xport/pic setups. Done, no hardware inputs, it works better conceptually as a closed system..

code 1 (my xport):


' based on Tom Igoe code


' variables and constants for the serial port:
dataByte var byte
dataByte2 var byte


init Var Byte
init = 0

dirt var Byte
dirt = 0

tx var portc.6
rx var portc.7
xportRx var portc.0
xportTx var portc.1
xportDTR var portc.2
inv9600 con 16468 ' baudmode for serin2 and serout2: 9600 8-N-1 inverted
non9600 con 84 ' baudmode for serin2 and serout2: 9600 8-N-1 non-inverted


led1 VAR portC.4
led2 VAR portC.3


Pause 1000 ' Wait a second at startup


' take DTR high so Xport doesn't disconnect when we first connect:
HIGH xportDTR


low led1
High led2 'on light


main:
if init =1 then
serin2 rx, inv9600, [dataByte]
else
serin2 xportRx, non9600, [dataByte]
endif
' parse the data:
gosub checkByte


goto main

checkByte:
if init = 0 Then
if dataByte = 73 then
init = 1
serout2 tx, inv9600, ["swap should happen", 10, 13]
endif
If dataByte <49 then
dirt = 1
dataByte = 49
Else
if dataByte >58 then
dirt = 0
dataByte = 58
endif
if dirt = 0 then
dataByte = dataByte -1
else
dataByte = dataByte +1
endif
endIF
Else
if dataByte = 126 then
init = 0
dataByte = 57
serout2 tx, inv9600, ["swap back should happen", 10, 13]
Endif
endIF
if dataByte > 47 and dataByte < 58 then
' convert the ascii value of 0-9 to a numeric value
' (ascii "0" = 48)
dataByte2 = dataByte - 48


' if we get "9", turn on light.
if dataByte2 = 9 then
High led1
endif
if dataByte2 = 8 then
Low led1
endif
' if we get a 0, then disconnect
' by taking the Lantronix device DTR low:
if dataByte2 = 0 then
low xportDTR
pause 300
high xportDTR
endif
' send all bytes straight out without parsing:
serout2 xportTx, non9600, [dataByte, 13]
serout2 tx, inv9600, [dataByte, 10, 13]
endif
return

code2 (alyssa's xport)


'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2005 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 2/7/2005 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
' Serial out to PC is on pin RC6
' serial in from PC is on pin RC7
' serial out to Lantronix device is on RD1
' serial in from Lantronix device is on RD0
' Lantronix device DTR pin is on RC3
' note: Lantronix device must have DisconnectMode set to 0x80
' in order to disconnect using DTR pin.


' variables and constants for the serial port:
dataByte var byte
dataByte2 var byte
tx var portc.6
rx var portc.7
xportTx var portd.1
xportRx var portd.0
xportDTR var portc.3
inv9600 con 16468 ' baudmode for serin2 and serout2: 9600 8-N-1 inverted
non9600 con 84 ' baudmode for serin2 and serout2: 9600 8-N-1 non-inverted

TRISB = %00000000 ' set all the pins of PORTB to output

' blink an LED on startup:
high portb.0
pause 1000
low portb.0


' take DTR high so Xport doesn't disconnect when we first connect:


HIGH xportDTR


Pause 1000 ' Wait a second at startup

main:
' check for incoming serial data from the net:
serin2 xportRx, non9600, [dataByte]
' parse the data:
gosub checkByte
goto main


checkByte:
if dataByte > 47 then
' convert the ascii value of 0-9 to a numeric value
' (ascii "0" = 48)
dataByte2 = dataByte - 48


' if the number is between 1 and 8, light an LED:
if dataByte2 > 0 && dataByte2 <= 8 then
' the dcd command takea a number and
' converts it to the position of a bit in a byte:
portb = dcd (databyte2 - 1)
endif


' if we get a 0, then disconnect
' by taking the Lantronix device DTR low:
if dataByte2 = 0 then
low xportDTR
pause 300
high xportDTR
endif
endif


' send all other bytes straight out without parsing:
serout2 xportTx, non9600, [dataByte, 13]
serout2 tx, inv9600, [dataByte, 10, 13]
return


Posted by William Blaze at 03:04 AM | TrackBack

February 12, 2005

incomplete code for alyssa's side

'****************************************************************
'*  Name    : UNTITLED.BAS                                      *
'*  Author  : [select VIEW...EDITOR OPTIONS]                    *
'*  Notice  : Copyright (c) 2005 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 2/7/2005                                          *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************
' Serial out to PC is on pin RC6
' serial in from PC is on pin RC7
' serial out to Lantronix device is on RD1
' serial in from Lantronix device is on RD0
' Lantronix device DTR pin is on RD2
' note: Lantronix device must have DisconnectMode set to 0x80
' in order to disconnect using DTR pin.

' an analog sensor is on pin RA0
' pins RB0 through RB7 have LEDs on them.

' Define ADCIN parameters
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

' variables and constants for the serial port:
dataByte var byte
dataByte2 var byte
tx var portc.6
rx var portc.7
xportTx var portd.1
xportRx var portd.0
xportDTR var portd.2
inv9600 con 16468 ' baudmode for serin2 and serout2: 9600 8-N-1 inverted
non9600 con 84 ' baudmode for serin2 and serout2: 9600 8-N-1 non-inverted

' general-purpose counter:
i var byte


'variables for ADC:
ADCvar var word ' Create variable to store result
TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000010 ' Set PORTA analog and right justify result
TRISB = %00000000 ' set all the pins of PORTB to output


' blink an LED on startup:
high portb.0
pause 1000
low portb.0

' take DTR high so Xport doesn't disconnect when we first connect:

HIGH xportDTR

Pause 1000 ' Wait a second at startup
input portc.4
qproxVar var byte

'set data in on c4
high portc.4
pause 1000
low portc.4

'set data in on c.5
high portc.5
pause 1000
low portc.5

main:
qproxVar = portc.4
debug "qprox = ", DEC qproxVar, 10, 13
'read the ADC value:
adcin 0, ADCvar
' check for incoming serial data from the net:
serin2 xportRx, non9600, [dataByte]
' parse the data:
gosub checkByte
goto main

checkByte:
if dataByte > 47 then
' convert the ascii value of 0-9 to a numeric value
' (ascii "0" = 48)
dataByte2 = dataByte - 48

' if the number is between 1 and 8, light an LED:
if dataByte2 > 0 && dataByte2 <= 8 then
' the dcd command takea a number and
' converts it to the position of a bit in a byte:
portb = dcd (databyte2 - 1)
endif

' if we get "9", send the ADC message.
if dataByte2 = 9 then
serout2 xportTx, non9600, [DEc 126, 10, 13]
serout2 tx, inv9600, [DEc 126, 10, 13]
endif

' if we get a 0, then disconnect
' by taking the Lantronix device DTR low:
if dataByte2 = 0 then
low xportDTR
pause 300
high xportDTR
endif
endif
' send all other bytes straight out without parsing:
serout2 xportTx, non9600, [dataByte, 10, 13]
serout2 tx, inv9600, [dataByte, 10, 13]
return



Posted by William Blaze at 10:46 PM | TrackBack

Code to set up and test xport/pic communication

' based on Tom Igoe code

' variables and constants for the serial port:
dataByte var byte
dataByte2 var byte

init Var Byte
init = 0

tx var portc.6
rx var portc.7
xportRx var portc.0
xportTx var portc.1
xportDTR var portc.2
inv9600 con 16468 ' baudmode for serin2 and serout2: 9600 8-N-1 inverted
non9600 con 84 ' baudmode for serin2 and serout2: 9600 8-N-1 non-inverted

led1 VAR portC.4
led2 VAR portC.3

Pause 1000 ' Wait a second at startup

' take DTR high so Xport doesn't disconnect when we first connect:
HIGH xportDTR

low led1
High led2 'on light

main:
if init =1 then
serin2 rx, inv9600, [dataByte]
else
serin2 xportRx, non9600, [dataByte]
endif
' parse the data:
gosub checkByte

goto main


checkByte:
if init = 0 Then
if dataByte = 55 or dataByte = 73 then
init = 1
serout2 tx, inv9600, ["swap should happen", 10, 13]
endIF
Else
if dataByte = 126 then
init = 0
dataByte = 57
serout2 tx, inv9600, ["swap back should happen", 10, 13]
Endif
endIF
if dataByte > 47 then
' convert the ascii value of 0-9 to a numeric value
' (ascii "0" = 48)
dataByte2 = dataByte - 48

' if we get "9", turn on light.
if dataByte2 = 9 then
' flashy = 1
High led1
endif
if dataByte2 = 8 then
'flashy = 0
Low led1
endif
' if we get a 0, then disconnect
' by taking the Lantronix device DTR low:
if dataByte2 = 0 then
low xportDTR
pause 300
high xportDTR
endif
' send all bytes straight out without parsing:
serout2 xportTx, non9600, [dataByte, 13]
serout2 tx, inv9600, [dataByte, 10, 13]
endif
return

Posted by William Blaze at 04:13 PM | TrackBack