Can I use picaxe to convert a l2c signal to rca serial data?

tesladude

New Member
I am relatively new at picaxe and programing all together but can get my way around. I want to know if I can use a camera module like one of these

http://www.ebay.com/itm/640x480-0-3Mega-Pixel-CMOS-Camera-Module-OV7660-SCCB-I2C-compatible-W-OV7670-/271230081889?pt=LH_DefaultDomain_0&hash=item3f26929b61

and use a picaxe to convert the stupid digital signal to a 1 line rca signal which I can transmit with an RF module. And before you suggest it,
yes I have looked for modules that already have an rca output and they are all above $30
 

Goeytex

Senior Member
This is not practical with a Picaxe. It simply does not have the processing power to do what you want.
 

Goeytex

Senior Member
Sure,

And there's tons of example code here on the Forum to draw from. It's basically an LCD module with a common parallel interface. It can be operated in either 8-bit or 4-bit mode ( 8 is a bit faster). Sometimes firmware ( a dedicated Microcontroller) is added to provide a Serial or I2C interface to the user.

These parallel modules need a lot of I/O pin to work, so you are not going to do it with an 8M2. You are looking at an 18 or 20 pin Picaxe if the Picaxe is going to do other stuff as well as control the display.

Forum members MARKS and nick12ab have posted a lot of good information/ code for these modules.
 

tesladude

New Member
lbenson, I think thats exactly what I need , (especially since I don't even have an 18m2 right now,) but I dan't want to just copy the program that was there, I really want to understand what the heck i'm typing because I've never hooked up an lcd or even interfaced with anything before so that was kinda lookin' like gibberish. So do you know if there is a page explaining how to use lcd for dummies or is it maybe something I could learn right here?
 

lbenson

Senior Member
tesladude--Hippy's code in the link is well commented (but it is compact and concise code). You might do well to read through it several times, looking up commands which you don't understand. Then get back to us with specific questions. There may be a "Theory of Operation" guide on the web somewhere, but I don't know where.

At the most fundamental level, the lcd has two modes--data and control. It can take information either in 8-bit form or 4-bit (nibble) form. Hippy's code takes the bytes which are to be sent to the lcd (either control or data) and breaks them into 4-bit chunks. He combines these data bits with the control bits ("E" and "RS") so that by writing to portB (pinsB=) he sets the data bits and clocks the data into the lcd at the same time.

You might find that you want to use some of the port B pins for something else (for instance, B.1, hserin). To do so, you would need to modify the wiring and the code to toggle the command bits separately. This would slow the process down (but not so much that you would be likely to notice on a 2x16-line LCD).
 

eclectic

Moderator
So do you know if there is a page explaining how to use lcd for dummies or is it maybe something I could learn right here?
Also, for background, see
Manual 3 (near top of this page)

pages 31 - 42.

And notice that it's entitled

Advanced...... :)

e
 

lbenson

Senior Member
Code:
SendCmdByte:

  rsbit = RSCMDmask               ; Send to Command register
rsbit is set to 0 (SYMBOL RSCMDmask = %00000000), which will be used to turn off the least significant bit of portB, B.0, which is the RS control line for the LCD, for which "1" indicates that a data byte is being sent (for display on the LCD) and "0" indicates that a control byte is being sent.

After this single line in sendcmdbyte, the program falls into SendDataByte. There the command byte or data byte is sent (most significant nibble, then least significant nibble) by pulsing the "E" line--b.1 in current terminology--after the control/data bit is set by OR-ing bite with rsbit (which is going to be either 1 for data or 0 for control).
 
Last edited:

tesladude

New Member
Believe it or not I understood that, I have been studying the lcd leasson on this manual for about the last hour and I think I understand
http://www.picaxe.com/docs/picaxe_manual3.pdf

after writing your phrase to be programmed you use the E and low RS to set up then lcd for recieving 4 bit communication and simply prepare it, then you loop transmitting one charecter at a time by pulsing the E and having RS high untill the loop has finished, then send a code with rs low telling the lcd to goto the next line, then just doing the same as with the first phrase until complete.


although i understand what the wrins wrchr do, I don't understand what is happening in the program writeing, is it somthing I should know and ask or should I just leave the whole concept of how they work alone?
 

lbenson

Senior Member
For low-level code like this, while it's good to understand it, if it frustrates you, just go ahead and use it.

If it nags at you, come back to it later when you have more context.
 

tesladude

New Member
ok thanks guys, I don't actually have an lcd module right now, it's on it's way from china so in a week or two I will try out what i've learned and see what happens,
this is what I've got:

Code:
EEPROM 0,("Hello World!")
symbol RS=b.2
symbol E=b.3
gosub init

Main:
	
	let b1=1
	gosub wrins
	
	for b3=0 to 4
	read b3,b1
	gosub wrchs
	next b3
	
	let b1=192
	gosub wrins
	
	for b3=5 to 11
	read b3,b1
	gosub wrchs
	next b3
	wait 1
	end
	
	
	
	

	
	





init: 

	let pinsb=0
	let b3=0
	let dirsb=0
	let dirsb=252
	pause 200
	let pinsb=48
	pulsout E,1
	pause 10
	pulsout E,1
	pulsout E,1 
	let pinsb=32
	pulsout E,1
	pulsout E,1
	let pinsb=128
	pulsout E,1
	let b1=14
	gosub wrins
	wait 3
	return
	
	
	
Wrchs:

	let pinsb=b1 & 240
	high RS
	pulsout E,1
	let b2=b1 * 16
	let pinsb=b2 & 240
	high RS
	pulsout E,1
	return
	
	
wrins:
	
	low RS
	let pinsb=b1 & 240
	pulsout E,1
	let b2=b1 * 16
	let pinsb=b2 & 240
	pulsout E,1
	high RS
	return

the simulator shows no problem but does anybody see one?
 

BeanieBots

Moderator
the simulator shows no problem but does anybody see one?
No, you should be good to go.
The biggest issue people have when buying cheap LCD units from China is that they do not know what controller it uses. The code you have is for an LCD using a HD44780 compliant controller. A quick look at the link you posted suggests it is the correct type. So, failing any wiring errors, it should work.
Make sure you have the contrast set at a sensible level or you might con yourself into thinking it's not working when it actually is. (adjust it until you just make out the rectangles for each character).
 

hippy

Technical Support
Staff member
After sending your 'clear screen' command you will want a pause to allow that to complete before sending any further commands or data.
 

Hemi345

Senior Member
See BillyGreen's post (it's at the bottom of the link nick12ab posted above). It is a great article to understand exactly how the parallel LCDs work which makes the code examples given much easier to understand.
 

tesladude

New Member
I put in
pause 4
I hope that is enough.
And I figured that I should make sure the module I get will work with the program but I wasn't thinking about that when I bought it, haha.


In then meantime I have another thing I'm practicing/working on, I am using the rfout command on a 14m2 and an 18m2 "because I don't have 2 of one of them."
I tested the programs directly connecting the rfout/in pins and was able to make it work pretty well, so I had the output and input set up to 433Mhz ASK modules and It worked just as well. This program transmits a signal telling the receiver weather the button is on or off thus turning an led on the receiver on and off,(simple RC circuit.)

transmitter 14m2:
Code:
symbol led=c.0
symbol butt=pinc.1


sayhi:

	for b20=0 to 1
	high led
	pause 250
	low led
	pause 250
	next b20
	goto start
	
	
start: 

	if butt=1 then
	gosub ley
	high led
	
	
	for b22=0 to 3
	rfout b.1,(b0,b1,b2,b3,b4,b5,b6,b7)
	pause 4
	next b22
	goto start
	
	else
	
	if butt=0 then
	gosub lettt
	low led
	
	for b24=0 to 3
	rfout b.1,(b0,b1,b2,b3,b4,b5,b6,b7)
	pause 4
	next b24
	goto start
	endif
	endif
	
ley:
	let b0=1
	let b1=2
	let b2=3
	let b3=4
	let b4=5
	let b5=6
	let b6=7
	let b7=8
	return
	
lettt:
	let b0=1
	let b1=2
	let b2=4
	let b3=4
	let b4=5
	let b5=5
	let b6=7
	let b7=8
	return


reciever 18m2:
Code:
symbol led=b.3

main: 
	for b20= 0 to 1
	high led
	pause 300
	low led
	pause 300
	next b20
	pause 100
	goto decode
	

decode:
	gosub getdata
	if b0=1 and b1=2 and b2=3 and b3=4 and b4=5 and b5=6 and b6=7 and b7=8 then
	high led
	goto decode
	else
	if b0=1 and b1=2 and b2=4 and b3=4 and b4=5 and b5=5 and b6=7 and b7=8 then
	low led
	goto decode
	else
	goto decode
	endif
	endif
	
getdata:

	let b0=0
	let b1=0
	let b2=0
	let b3=0
	let b4=0
	let b5=0
	let b6=0
	let b7=0
	rfin c.0,b0,b1,b2,b3,b4,b5,b6,b7
	return

so the next thing I tried was hooking up a potenciometer as a voltage divider on the transmitter then useing the readadc command setting the adc into b0 then transmitting it to the receiver, then having the receiver read b0 and set it into the pwmout dutycycle to the led.
thus as I Turn the pot it should remotely adjust the brightness of the led. But it didn't quite work, the led was going crazy!
So instead just to find what was going wrong I just set up the transmitter to readadc, then set to b0, then set b0 as pwmout to its own led, thus as I Turn the pot it should adjust the brightness of the led.
But the led just stayed the same brightness, here is that very simple program:
Code:
main:
	let b0=0
	readadc c.5,b0
	pwmout c.2,b0,100
	goto main
so why isn't even that working?
 

Goeytex

Senior Member
May I suggest you start a new thread for a new problem ?

This one is supposed to be about converting I2C data to Video, then it digressed to LCD stuff and now we are dealing with RF Data.
You will get better help when the thread title matches the problem.
 

Rick100

Senior Member
Code:
main:
	let b0=0
	readadc c.5,b0
	pwmout c.2,b0,100
	goto main
On the 14M2 C.5 is the Serial In (programming) pin and can't be used for adc. See the pinout.
http://www.picaxe.com/Site_Resources/Media/Site_1/pinout/pinout14m2.jpg
Change the readadc to another pin like C.4. You need to use the pwmout command to set up the pwm and then adjust the duty cycle with the pwmduty command. The programming editor has a wizard for doing that. Your program was using the readadc value to constantly reset the pwm frequency. Here is an example that seems to work in the simulator. It sets up a 1000 Hertz signal on C.2. The values for pwmduty are 0 - 999 so readadc10 will give full range.

Code:
#picaxe 14M2

setfreq m4

pwmout pwmdiv4, C.2, 249, 499 ; 1000Hz at 50% @ 4MHz

main:
	readadc10 c.4,w0
        w0 = w0 max 999
	pwmduty c.2,w0
	goto main
Good luck,
Rick
 
Last edited:
Top