I think you will find T2400 only works/receives if you have a MAX-232 chip.
Try N2400 and at the start of the sending, condition the line with
HIGH SO
pause 5
serout2 ............
HTH
Brian
I think you will find T2400 only works/receives if you have a MAX-232 chip.
Try N2400 and at the start of the sending, condition the line with
HIGH SO
pause 5
serout2 ............
HTH
Brian
Disregard the post above - it is right for SEROUT however.
I think you have mixed up the command syntax for your SEROUT2. I think your command line should be something like...
serout2 So, 396,["INIT", "1111", "2222", "333", "444"]
HTH
Brian
Thanks Brian,
The T2400 is a constant from modedefs.bas that I've included in my program (though I have tried using 396 and various other modes as well).
I've had easy success using this type of comms before between a pair of 16F's (a serial LCD module for example) but the 18F doesn't seem to like it so I guess I've done something wrong in my code.
Is there anything tricky about using porte for serial comms?
The only other thing that might have an effect is I'm running the projects at different speeds but I've used defines in both to tell PBP the clock speed.
Regards
Thirsty
Brian is spot-on about using 396 VS T2400 with SERIN2/SEROUT2. The constant serial mode
definitions in MODEDEFS.BAS like T2400 are for use with SERIN/SEROUT only.
PORTE on this PIC has A/D. Have you disabled A/D so these pins can be used for digital I/O?
Thanks Bruce.
I tried 396 (and a bunch of other modes) but no joy.
I have disabled the A/D and set porte to all digital IO.
I've read on this site that using an internal osc is a bad idea for asynch comms and I am using an internal osc on the 18F so I guess that could be the problem.
I guess I'll have to give this idea a miss and try synch comms using shiftin/out and write my own slave routine for the 18F.
Thanks for the replies anyway,
Regards
Thirsty
If you can't get SERIN2 to work, I'd skip the idea of writing your own Synchronous Slave routine.
You keep saying that you've set all ports to digital.
How did you do that? What statements did you use?
The method of turning off analog ports varies from PIC to PIC.
Are you sure you got the right ones?
Did you set TRISE.
If so what did you set it to?
I've seen people go TRISE=%11111111, thinking that they are setting PORTE to all input, but what it really does is turn on the PSP module, which along with other problems, disables PORTE.2 for general I/O.
Don't dismissed 396 as being correct, simply because you've tried it and it didn't work. 396 is the correct mode number, not T2400.
<br>
DT
Darrel, point taken.
Here is how I've set the configs (18F4525):
DEFINE OSC 8
OSCCON = %01110010
CMCON = %00000111
ADCON0 = %00000000 'Turn off A/D
ADCON1 = %00001111 'Make All ports Digital IO
TRISA = %00000000 'PortA is all outputs
TRISB = %00000000 'PortB is all outputs
TRISC = %00000000 'PortC is all outputs
TRISD = %00000000 'PortD is all outputs
TRISE = %00000110 'PortE.0 is output, 1 and 2 are inputs
As I've said though it seems lots of experienced guys on this forum advise not to use asynch comms when relying on an internal clock that's why I made my last comment.
Any further observations would be appreciated though,
Thirsty
Bookmarks