need help to read hserout from picaxe on 18f2525

va3rjy

New Member
I'm sending the followinf to a pic 18f2525

PTTerror:
hserout 0,(17,Statusb0,Statusb1)
hserout 0,(23,"PT")
hserout 0,(24,"T ")
hserout 0,(25," E")

I can't figure out how to read/display on a GLCD.

Any help would greatly be appreciated.
 

srnet

Senior Member
Not sure we can help with that one directly, your question appears to be about writing some custom software to run an a native PIC, not something supported by these forums.

You would do far better to work out what should be displayed on the LCD under the various circumstances and then possibly writing some PICAXE software to drive the GLCD directly.

Unless you know what the various hserouts above cause to be displayed on the GLCD (and where), you wont be able to progress.
 

va3rjy

New Member
Clarification..I'm alreay displaying clock info on the display.
I just don't know what code I need to read the RX input on the 18F2525.
 

Buzby

Senior Member
If you have the clock displaying on the GLCD, can we then assume you've got a pre-programmed 18F2525, or did you program it yourself ?
 

Goeytex

Senior Member
Background:
The PIC18F2525 is the driver/firmware for a GLCD board that is specifically designed to be used with an RF Switching Device. The code is not available for the PIC18F2525. This is not a standard GLCD but is a custom device that also includes a DS1307 Clock. The main device is the VK4DD PA Control PCB

The VK4DD website/forum has been inactive for about 2 years. The online store is closed.

@va3rjy

1. Do you have a VK4DD GLCD display board as supplied from VK4DD ?
2. Do you have a VK4DD PA Board as supplied from VK4DD? .;... or
3. Are you trying to build this system from scratch based upon the published diagrams ?

Hint: You cannot build a working GLCD board unless you have the code for the 18F2525 and the ability to program it.

Please tell us EXCATLY what you have. Where it came from and what you are trying do.
 

va3rjy

New Member
see below

1. Do you have a VK4DD GLCD display board as supplied from VK4DD ? YES - I BUILT IT MYSELF AND PROGRAMMED THE 18F2525 - THE DISPLAY AND CLOCK WORKS
2. Do you have a VK4DD PA Board as supplied from VK4DD? .;... or YES - I BUILT IT MYSELF AND PROGRAMMED the PIXAXE
3. Are you trying to build this system from scratch based upon the published diagrams ? YES

Hint: You cannot build a working GLCD board unless you have the code for the 18F2525 and the ability to program it.
 

Buzby

Senior Member
Now we have a clearer idea of what you've got, we can get down to diagnosing your problem !.

Firstly, is the 20X2 sending out the serial data as it should ?.

To test this just use the VK4DD board with the GLCD disconnected.
Then connect the serial out to a serial port on your PC (!!? I still live in the middle-ages ! )
If you've not got a serial port you can use the AXE027, it's easy enough to work out the connections.
Now launch a terminal emulator, HyperTerm if you've got it, or maybe the PE terminal, but I've not tried that.

You should now be able to see the commands from the 20X2 on your PC.

Once you have this we can move on.

Cheers,

Buzby
 

va3rjy

New Member
I can definitly see something coming out the serial ports, however not legibale in my terminal (4·4·4·4·4·4?4·4·4·4·).
 

AllyCat

Senior Member
Hi,

That looks very like an incorrect baud rate, or perhaps inverted polarity. What baud rates have you tried for the terminal?

Do you have any test gear? If not a 'scope or Logic Analyser, at least a multimeter to check if it's "idle high" or "idle low"?

Cheers, Alan.
 

hippy

Technical Support
Staff member
Lack of legibility could be that your terminal is not showing non-printable ASCII characters and/or the baud rate is incorrect. My gut feeling is it is quite likely the polarity is also incorrect; 'RS232' polarity is needed for connection to a PC but 'UART' polarity is often required for modules. It may be necessary to modify the HSERSETUP command when verifying the output with a terminal program.
 

va3rjy

New Member
I get thr following in 9600 baud rate.
ãñ
©$ßãñ
©$õ½ãñ
©$ßãñ
©$õ½ãñ
and
BB0BB0BB0BB0BB0BB0BB0BB0BB0BB
at 2400 baud

No scope or logic analyzer.
With a multimeter I see voltage alternating between approx 5.0 and 4.9
 

Goeytex

Senior Member
Is the baud rate & data polarity correct ?

How did you get the hex/asm code for the 18F2525? Did VK4DD finally respond and supply the code?

Please post the COMPLETE Picaxe Basic code that you are using.

As I read the ORIGINAL VK4DD Picaxe code ....

1. Picaxe is set to 64 Mhz clock
2. Hserial is set to B19200_64 with no background receive and the data non-inverted (hsersetup B19200_64, %000)

You seem to be trying the wrong baud rates. The VK4DD Picaxe Code implies that the GLCD firmware is set to 19200 Baud.
 
Last edited:

va3rjy

New Member
I changed hsersetup to "hsersetup B19200_64 %111" and finally in the terminal (vt100) I get something usefull.. my PTT ERR
ERRPTT ERRPTT ERRPTT ERRPTT ERRPTT ERRPTT ERRPTT ERRPTT ERRPTT
I never got the code 18F2525 code from VK4DD. I was able to write some simple code and got the clock to display the time. I stil haven't figured out how to adjust the time.
The assistance I need now is to display the serial output of the picaxe on the GLCD via the 18F2525.
 

Goeytex

Senior Member
I never got the code 18F2525 code from VK4DD. I was able to write some simple code and got the clock to display the time. I stil haven't figured out how to adjust the time.
The assistance I need now is to display the serial output of the picaxe on the GLCD via the 18F2525.
The PIC18F2525 drives the GLCD module. The code for the 18F2525 was probably written in C, compiled, and programmed into the PIC using a special programmer like a PICKIT/PICKIT2 or some other variation. The 18F2525 * MUST * be programmed to act as a driver between the PICAXE and the GLCD module. It must also be programmed to accept the button presses and to provide the menu system for the display. This includes the clock setting menu & related code.

We cannot help you with this.
 
Last edited:

hippy

Technical Support
Staff member
The assistance I need now is to display the serial output of the picaxe on the GLCD via the 18F2525.
That is not going to be easy to give unless we can be told what the GLCD controlling 18F2525 is expecting to receive to do what you want it to do.
 

va3rjy

New Member
This is the code I currently have on the 18f2525. I compiled it and used a PICKIT 3 to program the chip.

Code:
Device = 18F2525
Clock =   40                              '  external crystal x 4



#Option GLCD_SCREEN_WIDTH = 196
#Option GLCD_SCREEN_HEIGHT = 64

#Option GLCD_DATA = PORTB
#Option GLCD_RS = PORTA.3
#Option GLCD_CS1 = PORTA.4
#Option GLCD_CS2 = PORTA.5
#Option GLCD_RW = PORTA.2
#Option GLCD_EN = PORTA.1
#Option GLCD_RST = PORTA.0

#Option GLCD_MODEL = KS0108

Include "GLCD.bas"
Include "FixedFont.bas"
Include "Arial.bas"
Include "Garamond.bas"
Include "Tahoma.bas"
Include "Verdana.bas"
Include "Times.bas"
Include "DS1307.bas" 
Include "convert.bas"
Include "utils.bas"
Include "graphics.bas"
Include "ks0108.bas"
ADCON1 = $07 // PORTE as digital (GLCD)

SetAllDigital()

GLCD.Cls   
GLCD.SetFont(Fixed)
GLCD.WriteAt(4,2,"RESET")

// local variables...
#option DS1307_SI2C = true
#option I2C_SDA = PORTC.4
#option I2C_SCL = PORTC.3


// if the DS1307 device has not been enabled, we need to give
// it some default values - here we set for 2 o'clock  
// on the 19th April 2007...
If Not Enabled Then
   Time.Hour = 14
  Time.Minute = 32
   Time.Second = 27
   Date.Day = 19
   Date.Month = 04
   Date.Year = 14
   DS1307.Write(Time,Date)
EndIf

While true
  DS1307.Read(Time,Date)
  GLCD.SetFont(Fixed)
    GLCD.WriteAt(10,0,DecToStr(Time.Hour,2),":",DecToStr(Time.Minute,2),":",DecToStr(Time.Second,2))
    GLCD.WriteAt(10,40,DecToStr(Date.Day,2),"/",DecToStr(Date.Month,2),"/",DecToStr(Date.Year,2))
Wend
I know the VK4DD received some assistance from the Swordfish forum to solve the same/similar issue. Below are some links to some of the questions he (xnederlandx) had.
http://www.sfcompiler.co.uk/phpBB3/viewtopic.php?f=4&t=1054&sid=7468dcac0d1d48cf157a52f9b1fbdb2d&start=15
http://www.sfcompiler.co.uk/phpBB3/viewtopic.php?f=4&t=1054
 

Goeytex

Senior Member
@hippy

The PIC18F2525 has not been programmed to receive serial data and convert it to Parallel Data for the GLCD module. So the 18F2525 is expecting nothing since it not programmed to do so.
 

Goeytex

Senior Member
We generally support Picaxe chips and Picaxe Basic here. What you are asking for is support for a raw PIC using Swordfish Basic. Unless some kind soul comes along and takes up your cause, I'm afraid that you will not get the support that you need (or deserve) here at the Picaxe Forums. It's too bad that VK4DD no longer offers any support and cannot or will not supply you the code for the GLCD board .

Another option is to replace the 18F2525 with a Picaxe 28x2 and then try to write the complete code yourself in Picaxe Basic. Then you are likely to get some help here.
 

va3rjy

New Member
I'm unable to ask any questions until I'm "validated" on the swordfish forum.

What do the numbers mean (23, 24...etc) below?
hserout 0,(23,"PT")
hserout 0,(24,"T ")
hserout 0,(25," E")
 

Goeytex

Senior Member
There is no way to tell what these command are telling the 18F2525 to do without having the complete GLCD code. This will be a major obstacle in trying to clone the GLCD code whether on a 18F2525 or a Picaxe. If you don't know what the 18F2525 is supposed to with the commands, how can you clone the code?
 

Dippy

Moderator
The Swordfish code you have posted doesn't tell the PIC to receive serial. Is there more?
Is there an Include which does serial read ? (or I can't see).

You will have to include USART.bas and then read the PIC flag to test for serial data in the buffer or use an interrupt to pick up the bytes.
Include "usart.bas"

After inclusion look at routines like dataavailable or dataavailabletimeout (these check buffer register/flags). Then USART.Readbyte().
These can be seen in the compiler's Coe Explorer window on the left.

Interrupts are a little more complex and often unnecessary and sometimes foul things up.
I used SF a lot but you'll have to go to Swordfish Forum for detailed help.
 

srnet

Senior Member
I'm unable to ask any questions until I'm "validated" on the swordfish forum.

What do the numbers mean (23, 24...etc) below?
hserout 0,(23,"PT")
hserout 0,(24,"T ")
hserout 0,(25," E")
I suspect you believe that the serial data going into the 18F2525, is following some form of standard protocal but thats not the case unfortunately.

Conventionally characters below 32 are non printing\display in the ASCII sense, so they may be used for some form of command interface instructing the PIC 18F2525 to do something in particular with the text, such as the "PT", that follows.
 

srnet

Senior Member
Dispose of the PIC, replace with PICAXE 28X2, then WE can help !.
Yep, a PICAXE forum is not the best place to get support for a competing product such as Swordfish basic.

There is code that drives a graphic LCD as a text display, the diminuative Nokia 5100. It runs quite happily on a 20X2 at 9600 baud.
 
Top