Let's Make Robots!

Help with Picaxe and serial LCD

Ok Picaxe Basic Gurus... I think I need some code snippits...

My new serial enabled LCD just arrived and I can't seem to get it up and running. I am using what I think is the standard picaxe basic commands but I am only getting white blocks, x's and some other random symbols. To be honest, I am confused with a lot of the serial commands in general, the whole ASCII thing and anything written as 0x7C or 0x14 or whatever.

Here is the display.

Here is the PDF

For instance, I first need to change the baud rate. The instructions tell me to send 124 followed by "<control>k" . Now it seems the picaxe standard is 2400 baud. What is the actual command? Do I send the "change baud" command at 2400 baud when the display is at a default of 9600? and then the command number is 124 and also 0x7C so what do I do?

In my mind (and to show I have no idea what I am doing) here are all the options I can see:

serout 7,N2400, (124, "<control>K")

-or-

serout 7,N2400,(124)

pause 5

serout 7,N2400,("<control>K")

-or-

serout 7,N2400,($7c, "<control>k")

I could go on and on with my guessing but nothing is working.

In general, I assume my major problem is with the baud rate, I hope and assume that after I get that fixed I should be able to return to the standard serout 7,N2400,("Hello") sorta commands.

Would anyone be so kind as to give me a crash course on what you think I should know?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
voodoobot's picture

hey ctc, I found this...it might help

http://www.andrew.meachen.net/LCDs.html

this looks to be some code that would work.

he's got code that may help to understand and test your rig.

as a side, I was curious to know if you had checked to see if you were in fact transmitting the data at 9600. had you tried looking at the terminal window in the picaxe editor....?

 

good luck!

 

 

voodoobot's picture

edit: I left out this link with the code that looked to be with your model....oops :)  it's at the very bottom of the page in thefirst link

http://www.andrew.meachen.net/images/LCD%27s/LCD-16x2%20SPARK%20FUN.BAS
rik's picture

The more I stare at the numbers and the graph, the more I am convinced that bitwise inversion (zeroes becoming ones and vv) is at least one of our worries.

But I do not understand how exactly the T9600_8 vs N9600_8 fits into that problem/solution. I just notice that this Antipode Andrew uses T9600_8.

Chris, did you really find that an impossible command? Then I would imagine there is a second problem that needs resolving before the inversion. I'll have a go with the numbers again. Later today. Maybe not until next year.

Have a safe year's end all!

8ik

robologist's picture
I think Chris said he had a 16 MHz resonator rather than an 8MHz, so possibly T9600_16 might work?
robologist's picture
Didn't see the setfreq to recognize what it did. Maybe trying at the native frequency to see if it works?
OddBot's picture
One thing i noticed is that he is giving the LCD time to initialise and process commands. Are you allowing the minimum setup time?
voodoobot's picture
doesn't everyone add extra time to their code when they are debugging??   :)
Chris the Carpenter's picture

I can't seem to find a pattern either. But I know why the 124 is not working. If all the numbers are off in comparison to the ascii scale, 124 will be off too!

 

Chris the Carpenter's picture

 Here's the list, rik. Some of them might be wrong as I had a hard time watching the debug screen and the lcd and writing at the same time. At this point I can write words out such as "HELLO CHRIS!" using this:

setfreq em8

main:
serout 7,N9600_8,(111,117,103,103,97,100,121,111,91,109,89,122)


I guess I could live with doing it this way but I still can't seem to access the 124 command in any form... i.e. I can't clear the screen or move the curser. At least at this point we have a full list of what is going in and coming out. --Does this list tell you anything?

 

 

33 o

34 7

35 n

36

37 m

38 6

39 l

40 white square

41 k

42 5

43 j

44 .

45 i

46 4

47 h

48 

49 g

50 3

51 f

52

53 e

54 2

55 d

56 white square

57 c

58 1

59 b

60

61 a

62 0

63 '

64 white square

65 _

66 /

67 ^

68 

69 ]

70 .

71 a Y with two lines through it

72 

73 [

74 -

75 z

76 

77 Y

78 

79 g

80 X

81 W

82 +

83 

84 V

85 

86 *

87 T

88 

89 S

90 )

91 R

92 

93 Q

94 (

95 P

96 white square

97 O

98 '

99 N

100

101 M

102 &

103 L

104 white square

105 K

106 %

107 J

108

109 I

110 $

111 H

112 white square

113 G

114 #

115 F

116 

117 E

118 "

119 D

120

121 C

122 !

123 B


 

rik's picture

"cannot move the curser": just get yourself a chair on wheels and kick your table ;-)

I am working on the "translation", if there is one...

8ik