Instructable modification help!

Hi all!

Im sure many of you have seen the instructable:
http://www.instructables.com/id/Control-real-world-devices-with-your-PC/

Ok so it uses the use of the serin and serout commands and i have it all working fine ... But can someone explain to me if its possible to use the serrxd and sertxd commands as this would be so much easier from a hardware point of view!
I have tried changing them over and also changing the VB net baud rate to suit but it doesn't register ...
Any suggestions?
A working program or explanation would be much appreciated!

I'm using a picaxe 28X1 as a 08M wont support Serrxd

Cheers!

Leechy
 

eclectic

Moderator
Leechy, it's nearly 02.00 in
Adelaide,
so the Doc is either asleep or on night duty.

I'm sure he'll try to help
when he logs on.

e
 

hippy

Ex-Staff (retired)
It certainly should be possible to convert from SERIN / SEROUT to SERRXD / SERTXD, and in theory a fairly easy task - unless Dr.A is doing something very odd or 'clever', which I don't think is the case.
 

hippy

Ex-Staff (retired)
This the code from

http://www.instructables.com/id/Control-real-world-devices-with-your-PC/step5/Download-the-picaxe-program/

Code:
main:serin 3,N2400,("Data"),b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13
readadc 1,b1' read the pot then send this back
serout 0,N2400,("Data", b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13)
select case b0' read data bit b0
case <140' if <140 then set servo to one position
servo 2,120
pause 1000' pause a second
else
servo 2,160
pause 1000
endselect
low 2' turn off the servo as serin does this anyway
goto main
Converted to SERRXD / SERTXD, baud rate at 4800 for the VB program, untested ...

Code:
main:serrxd ("Data"),b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13
readadc 1,b1' read the pot then send this back
sertxd ("Data", b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13)
select case b0' read data bit b0
case <140' if <140 then set servo to one position
servo 2,120
pause 1000' pause a second
else
servo 2,160
pause 1000
endselect
low 2' turn off the servo as serin does this anyway
goto main
 
Thats exactly what i've tried doing, but for some reason i have had no result:

Code:
main:	
	                        'serin 3,N2400,("Data"),b0,b1,b2,b3,b4,b5,b6
	
        high7

        serrxd("Data"),b0,b1,b2,b3,b4,b5,b6

	low 7

	                       
	sertxd("Data", b0,b1,b2,b3,b4,b5,b6)

                                  'serout 0,N2400,("Data", b0,b1,b2,b3,b4,b5,b6)
       .....etc
I have modified both programs so that it only uses 7 registers and have inserted an led on pin 28 that should go out when it gets past the serrxd command ... But it doesn't manage it :(

Code:
Try
            With serialPort
                .PortName = "COM2"          ' the port im using
                .BaudRate = 4800             ' originally 2400
                .Parity = IO.Ports.Parity.None     ' no parity
                .DataBits = 8                           ' 8 bits
                .StopBits = IO.Ports.StopBits.One ' one stop bit
                .ReadTimeout = 1000               ' milliseconds so times out in 1 second if no response
                .Open() ' open the serial port
                .DiscardInBuffer() ' clear the input buffer
                .Write(DataPacket, 0, 11) ' send the datapacket array
                Call Sleep(300) ' 100 milliseconds minimum to wait for data to come back and more if data stream is longer
                .Read(DataPacket, 0, 11) ' read back in the data packet array
                .Close() ' close the serial port
            End With
            For i = 4 To 11
                LabelString = LabelString + " " + Str(DataPacket(i)) ' turn into a text string
            Next
Apart from something wrong with that ... I'm stumped! lol

Thanks!

leechy
 

hippy

Ex-Staff (retired)
I'd take a step back and use unmodified apart from SERRXD/SERTXD and baud rate changes in case buffer size and amount sent / received does affect things in some ways.

If that doesn't work then I'm not sure why not, I'd expect it to work.
 

moxhamj

New Member
@everyone - Thanks for holding the fort through the night!

Alex - Can you break it down into individual components? There are so many things that have to be right and all working at the same time. Baud rates, wiring, software at both ends.

First up, could you post a photo?

Did you get it working with an 08M?
 
Top